Re: r270373 - [driver][mips] Support new versions of MIPS CodeScape toolchains

2016-05-26 Thread Ismail Donmez via cfe-commits
Any ideas what's going on?

On Wed, May 25, 2016 at 1:35 PM, Ismail Donmez  wrote:
> Hi,
>
> On Wed, May 25, 2016 at 1:32 PM, Simon Atanasyan  wrote:
>> Hi,
>>
>> Thanks for the information. One more question. Does the following folder 
>> exist?
>>
>> /home/abuild/rpmbuild/BUILD/llvm/tools/clang/test/Driver/Inputs/mips_img_v2_tree/lib/gcc/mips-img-linux-gnu/4.9.2/../../../../mips-img-linux-gnu/include/c++/4.9.2
>>
>
> Yes :
>
> :/ # ls 
> /home/abuild/rpmbuild/BUILD/llvm/tools/clang/test/Driver/Inputs/mips_img_v2_tree/lib/gcc/mips-img-linux-gnu/4.9.2/../../../../mips-img-linux-gnu/include/c++/4.9.2
> mips-img-linux-gnu
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20562: [Clang][AVX512][BUILTIN] Adding intrinsics for set1

2016-05-26 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL270825: [Clang][AVX512][BUILTIN] Adding intrinsics for set1 
(authored by mzuckerm).

Changed prior to commit:
  http://reviews.llvm.org/D20562?vs=58213&id=58574#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20562

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

Index: cfe/trunk/test/CodeGen/avx512f-builtins.c
===
--- cfe/trunk/test/CodeGen/avx512f-builtins.c
+++ cfe/trunk/test/CodeGen/avx512f-builtins.c
@@ -5951,6 +5951,36 @@
   return _mm512_castpd128_pd512(__A); 
 }
 
+__m512d test_mm512_set1_epi8(char d)
+{
+  // CHECK-LABEL: @test_mm512_set1_epi8
+  // CHECK: insertelement <64 x i8> {{.*}}, i32 0
+  // CHECK: insertelement <64 x i8> {{.*}}, i32 1
+  // CHECK: insertelement <64 x i8> {{.*}}, i32 2
+  // CHECK: insertelement <64 x i8> {{.*}}, i32 3
+  // CHECK: insertelement <64 x i8> {{.*}}, i32 4
+  // CHECK: insertelement <64 x i8> {{.*}}, i32 5
+  // CHECK: insertelement <64 x i8> {{.*}}, i32 6
+  // CHECK: insertelement <64 x i8> {{.*}}, i32 7
+  // CHECK: insertelement <64 x i8> {{.*}}, i32 63
+  return _mm512_set1_epi8(d);
+}
+
+__m512d test_mm512_set1_epi16(short d)
+{
+  // CHECK-LABEL: @test_mm512_set1_epi16
+  // CHECK: insertelement <32 x i16> {{.*}}, i32 0
+  // CHECK: insertelement <32 x i16> {{.*}}, i32 1
+  // CHECK: insertelement <32 x i16> {{.*}}, i32 2
+  // CHECK: insertelement <32 x i16> {{.*}}, i32 3
+  // CHECK: insertelement <32 x i16> {{.*}}, i32 4
+  // CHECK: insertelement <32 x i16> {{.*}}, i32 5
+  // CHECK: insertelement <32 x i16> {{.*}}, i32 6
+  // CHECK: insertelement <32 x i16> {{.*}}, i32 7
+  // CHECK: insertelement <32 x i16> {{.*}}, i32 31
+  return _mm512_set1_epi16(d);
+}
+
 __m512d test_mm512_castpd256_pd512(__m256d a)
 {
   // CHECK-LABEL: @test_mm512_castpd256_pd512
Index: cfe/trunk/lib/Headers/avx512fintrin.h
===
--- cfe/trunk/lib/Headers/avx512fintrin.h
+++ cfe/trunk/lib/Headers/avx512fintrin.h
@@ -27,6 +27,8 @@
 #ifndef __AVX512FINTRIN_H
 #define __AVX512FINTRIN_H
 
+typedef char __v64qi __attribute__((__vector_size__(64)));
+typedef short __v32hi __attribute__((__vector_size__(64)));
 typedef double __v8df __attribute__((__vector_size__(64)));
 typedef float __v16sf __attribute__((__vector_size__(64)));
 typedef long long __v8di __attribute__((__vector_size__(64)));
@@ -286,6 +288,28 @@
 }
 
 static __inline __m512i __DEFAULT_FN_ATTRS
+_mm512_set1_epi8(char __w)
+{
+  return (__m512i)(__v64qi){ __w, __w, __w, __w, __w, __w, __w, __w,
+ __w, __w, __w, __w, __w, __w, __w, __w,
+ __w, __w, __w, __w, __w, __w, __w, __w,
+ __w, __w, __w, __w, __w, __w, __w, __w,
+ __w, __w, __w, __w, __w, __w, __w, __w,
+ __w, __w, __w, __w, __w, __w, __w, __w,
+ __w, __w, __w, __w, __w, __w, __w, __w,
+ __w, __w, __w, __w, __w, __w, __w, __w  };
+}
+
+static __inline __m512i __DEFAULT_FN_ATTRS
+_mm512_set1_epi16(short __w)
+{
+  return (__m512i)(__v32hi){ __w, __w, __w, __w, __w, __w, __w, __w,
+ __w, __w, __w, __w, __w, __w, __w, __w,
+ __w, __w, __w, __w, __w, __w, __w, __w,
+ __w, __w, __w, __w, __w, __w, __w, __w };
+}
+
+static __inline __m512i __DEFAULT_FN_ATTRS
 _mm512_set1_epi32(int __s)
 {
   return (__m512i)(__v16si){ __s, __s, __s, __s, __s, __s, __s, __s,


Index: cfe/trunk/test/CodeGen/avx512f-builtins.c
===
--- cfe/trunk/test/CodeGen/avx512f-builtins.c
+++ cfe/trunk/test/CodeGen/avx512f-builtins.c
@@ -5951,6 +5951,36 @@
   return _mm512_castpd128_pd512(__A); 
 }
 
+__m512d test_mm512_set1_epi8(char d)
+{
+  // CHECK-LABEL: @test_mm512_set1_epi8
+  // CHECK: insertelement <64 x i8> {{.*}}, i32 0
+  // CHECK: insertelement <64 x i8> {{.*}}, i32 1
+  // CHECK: insertelement <64 x i8> {{.*}}, i32 2
+  // CHECK: insertelement <64 x i8> {{.*}}, i32 3
+  // CHECK: insertelement <64 x i8> {{.*}}, i32 4
+  // CHECK: insertelement <64 x i8> {{.*}}, i32 5
+  // CHECK: insertelement <64 x i8> {{.*}}, i32 6
+  // CHECK: insertelement <64 x i8> {{.*}}, i32 7
+  // CHECK: insertelement <64 x i8> {{.*}}, i32 63
+  return _mm512_set1_epi8(d);
+}
+
+__m512d test_mm512_set1_epi16(short d)
+{
+  // CHECK-LABEL: @test_mm512_set1_epi16
+  // CHECK: insertelement <32 x i16> {{.*}}, i32 0
+  // CHECK: insertelement <32 x i16> {{.*}}, i32 1
+  // CHECK: insertelement <32 x i16> {{.*}}, i32 2
+  // CHECK: insertelement <32 x i16> {{.*}}, i32 3
+  // CHECK: insertelement <32 x i16> {{.*}}, i32 4
+  // CHECK: insertelement <32 x i16> {{.*}}, i32 5
+  // CHECK: insertelement <32 x i16> {

r270825 - [Clang][AVX512][BUILTIN] Adding intrinsics for set1

2016-05-26 Thread Michael Zuckerman via cfe-commits
Author: mzuckerm
Date: Thu May 26 01:54:52 2016
New Revision: 270825

URL: http://llvm.org/viewvc/llvm-project?rev=270825&view=rev
Log:
[Clang][AVX512][BUILTIN] Adding intrinsics for set1

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

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

Modified: cfe/trunk/lib/Headers/avx512fintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512fintrin.h?rev=270825&r1=270824&r2=270825&view=diff
==
--- cfe/trunk/lib/Headers/avx512fintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512fintrin.h Thu May 26 01:54:52 2016
@@ -27,6 +27,8 @@
 #ifndef __AVX512FINTRIN_H
 #define __AVX512FINTRIN_H
 
+typedef char __v64qi __attribute__((__vector_size__(64)));
+typedef short __v32hi __attribute__((__vector_size__(64)));
 typedef double __v8df __attribute__((__vector_size__(64)));
 typedef float __v16sf __attribute__((__vector_size__(64)));
 typedef long long __v8di __attribute__((__vector_size__(64)));
@@ -286,6 +288,28 @@ _mm512_set1_pd(double __w)
 }
 
 static __inline __m512i __DEFAULT_FN_ATTRS
+_mm512_set1_epi8(char __w)
+{
+  return (__m512i)(__v64qi){ __w, __w, __w, __w, __w, __w, __w, __w,
+ __w, __w, __w, __w, __w, __w, __w, __w,
+ __w, __w, __w, __w, __w, __w, __w, __w,
+ __w, __w, __w, __w, __w, __w, __w, __w,
+ __w, __w, __w, __w, __w, __w, __w, __w,
+ __w, __w, __w, __w, __w, __w, __w, __w,
+ __w, __w, __w, __w, __w, __w, __w, __w,
+ __w, __w, __w, __w, __w, __w, __w, __w  };
+}
+
+static __inline __m512i __DEFAULT_FN_ATTRS
+_mm512_set1_epi16(short __w)
+{
+  return (__m512i)(__v32hi){ __w, __w, __w, __w, __w, __w, __w, __w,
+ __w, __w, __w, __w, __w, __w, __w, __w,
+ __w, __w, __w, __w, __w, __w, __w, __w,
+ __w, __w, __w, __w, __w, __w, __w, __w };
+}
+
+static __inline __m512i __DEFAULT_FN_ATTRS
 _mm512_set1_epi32(int __s)
 {
   return (__m512i)(__v16si){ __s, __s, __s, __s, __s, __s, __s, __s,

Modified: cfe/trunk/test/CodeGen/avx512f-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512f-builtins.c?rev=270825&r1=270824&r2=270825&view=diff
==
--- cfe/trunk/test/CodeGen/avx512f-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx512f-builtins.c Thu May 26 01:54:52 2016
@@ -5951,6 +5951,36 @@ __m512d test_mm512_castpd128_pd512(__m12
   return _mm512_castpd128_pd512(__A); 
 }
 
+__m512d test_mm512_set1_epi8(char d)
+{
+  // CHECK-LABEL: @test_mm512_set1_epi8
+  // CHECK: insertelement <64 x i8> {{.*}}, i32 0
+  // CHECK: insertelement <64 x i8> {{.*}}, i32 1
+  // CHECK: insertelement <64 x i8> {{.*}}, i32 2
+  // CHECK: insertelement <64 x i8> {{.*}}, i32 3
+  // CHECK: insertelement <64 x i8> {{.*}}, i32 4
+  // CHECK: insertelement <64 x i8> {{.*}}, i32 5
+  // CHECK: insertelement <64 x i8> {{.*}}, i32 6
+  // CHECK: insertelement <64 x i8> {{.*}}, i32 7
+  // CHECK: insertelement <64 x i8> {{.*}}, i32 63
+  return _mm512_set1_epi8(d);
+}
+
+__m512d test_mm512_set1_epi16(short d)
+{
+  // CHECK-LABEL: @test_mm512_set1_epi16
+  // CHECK: insertelement <32 x i16> {{.*}}, i32 0
+  // CHECK: insertelement <32 x i16> {{.*}}, i32 1
+  // CHECK: insertelement <32 x i16> {{.*}}, i32 2
+  // CHECK: insertelement <32 x i16> {{.*}}, i32 3
+  // CHECK: insertelement <32 x i16> {{.*}}, i32 4
+  // CHECK: insertelement <32 x i16> {{.*}}, i32 5
+  // CHECK: insertelement <32 x i16> {{.*}}, i32 6
+  // CHECK: insertelement <32 x i16> {{.*}}, i32 7
+  // CHECK: insertelement <32 x i16> {{.*}}, i32 31
+  return _mm512_set1_epi16(d);
+}
+
 __m512d test_mm512_castpd256_pd512(__m256d a)
 {
   // CHECK-LABEL: @test_mm512_castpd256_pd512


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


Re: r270373 - [driver][mips] Support new versions of MIPS CodeScape toolchains

2016-05-26 Thread Simon Atanasyan via cfe-commits
I'm trying to reproduce the problem but without success yet. And all
buildbots available to me are green. So no ideas right now.

By the way, as far as I can see you use some sort of build system
probably to get rpm package. Right? Could you try to build Clang by
hand (http://clang.llvm.org/get_started.html) and run the tests. Is
the problem reproduced in that case?

On Thu, May 26, 2016 at 10:01 AM, Ismail Donmez  wrote:
> Any ideas what's going on?
>
> On Wed, May 25, 2016 at 1:35 PM, Ismail Donmez  wrote:
>> Hi,
>>
>> On Wed, May 25, 2016 at 1:32 PM, Simon Atanasyan  wrote:
>>> Hi,
>>>
>>> Thanks for the information. One more question. Does the following folder 
>>> exist?
>>>
>>> /home/abuild/rpmbuild/BUILD/llvm/tools/clang/test/Driver/Inputs/mips_img_v2_tree/lib/gcc/mips-img-linux-gnu/4.9.2/../../../../mips-img-linux-gnu/include/c++/4.9.2
>>>
>>
>> Yes :
>>
>> :/ # ls 
>> /home/abuild/rpmbuild/BUILD/llvm/tools/clang/test/Driver/Inputs/mips_img_v2_tree/lib/gcc/mips-img-linux-gnu/4.9.2/../../../../mips-img-linux-gnu/include/c++/4.9.2
>> mips-img-linux-gnu

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


[PATCH] D20666: Fix a wrong check in misc-unused-using-decls

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

We should check whether a UsingDecl is defined in macros or in class
definition, not TargetDecls of the UsingDecl.

http://reviews.llvm.org/D20666

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

Index: test/clang-tidy/misc-unused-using-decls.cpp
===
--- test/clang-tidy/misc-unused-using-decls.cpp
+++ test/clang-tidy/misc-unused-using-decls.cpp
@@ -33,6 +33,7 @@
 template  int UsedInTemplateFunc() { return 1; }
 void OverloadFunc(int);
 void OverloadFunc(double);
+int FuncUsedByUsingDeclInMacro() { return 1; }
 
 class ostream {
 public:
@@ -93,6 +94,11 @@
 DEFINE_INT(test);
 #undef DEFIND_INT
 
+#define USING_FUNC \
+  using n::FuncUsedByUsingDeclInMacro;
+USING_FUNC
+#undef USING_FUNC
+
 // - Usages -
 void f(B b);
 void g() {
Index: clang-tidy/misc/UnusedUsingDeclsCheck.cpp
===
--- clang-tidy/misc/UnusedUsingDeclsCheck.cpp
+++ clang-tidy/misc/UnusedUsingDeclsCheck.cpp
@@ -18,20 +18,10 @@
 namespace tidy {
 namespace misc {
 
-// A function that helps to tell whether a TargetDecl will be checked.
-// We only check a TargetDecl if :
-//   * The corresponding UsingDecl is not defined in macros or in class
-// definitions.
-//   * Only variable, function and class types are considered.
+// A function that helps to tell whether a TargetDecl in a UsingDecl will be
+// checked. Only variable, function, function template, class template and 
class
+// are considered.
 static bool ShouldCheckDecl(const Decl *TargetDecl) {
-  // Ignores using-declarations defined in macros.
-  if (TargetDecl->getLocation().isMacroID())
-return false;
-
-  // Ignores using-declarations defined in class definition.
-  if (isa(TargetDecl->getDeclContext()))
-return false;
-
   return isa(TargetDecl) || isa(TargetDecl) ||
  isa(TargetDecl) || isa(TargetDecl) ||
  isa(TargetDecl);
@@ -49,6 +39,14 @@
 
 void UnusedUsingDeclsCheck::check(const MatchFinder::MatchResult &Result) {
   if (const auto *Using = Result.Nodes.getNodeAs("using")) {
+// Ignores using-declarations defined in macros.
+if (Using->getLocation().isMacroID())
+  return ;
+
+// Ignores using-declarations defined in class definition.
+if (isa(Using->getDeclContext()))
+  return ;
+
 UsingDeclContext Context(Using);
 Context.UsingDeclRange = CharSourceRange::getCharRange(
 Using->getLocStart(),


Index: test/clang-tidy/misc-unused-using-decls.cpp
===
--- test/clang-tidy/misc-unused-using-decls.cpp
+++ test/clang-tidy/misc-unused-using-decls.cpp
@@ -33,6 +33,7 @@
 template  int UsedInTemplateFunc() { return 1; }
 void OverloadFunc(int);
 void OverloadFunc(double);
+int FuncUsedByUsingDeclInMacro() { return 1; }
 
 class ostream {
 public:
@@ -93,6 +94,11 @@
 DEFINE_INT(test);
 #undef DEFIND_INT
 
+#define USING_FUNC \
+  using n::FuncUsedByUsingDeclInMacro;
+USING_FUNC
+#undef USING_FUNC
+
 // - Usages -
 void f(B b);
 void g() {
Index: clang-tidy/misc/UnusedUsingDeclsCheck.cpp
===
--- clang-tidy/misc/UnusedUsingDeclsCheck.cpp
+++ clang-tidy/misc/UnusedUsingDeclsCheck.cpp
@@ -18,20 +18,10 @@
 namespace tidy {
 namespace misc {
 
-// A function that helps to tell whether a TargetDecl will be checked.
-// We only check a TargetDecl if :
-//   * The corresponding UsingDecl is not defined in macros or in class
-// definitions.
-//   * Only variable, function and class types are considered.
+// A function that helps to tell whether a TargetDecl in a UsingDecl will be
+// checked. Only variable, function, function template, class template and class
+// are considered.
 static bool ShouldCheckDecl(const Decl *TargetDecl) {
-  // Ignores using-declarations defined in macros.
-  if (TargetDecl->getLocation().isMacroID())
-return false;
-
-  // Ignores using-declarations defined in class definition.
-  if (isa(TargetDecl->getDeclContext()))
-return false;
-
   return isa(TargetDecl) || isa(TargetDecl) ||
  isa(TargetDecl) || isa(TargetDecl) ||
  isa(TargetDecl);
@@ -49,6 +39,14 @@
 
 void UnusedUsingDeclsCheck::check(const MatchFinder::MatchResult &Result) {
   if (const auto *Using = Result.Nodes.getNodeAs("using")) {
+// Ignores using-declarations defined in macros.
+if (Using->getLocation().isMacroID())
+  return ;
+
+// Ignores using-declarations defined in class definition.
+if (isa(Using->getDeclContext()))
+  return ;
+
 UsingDeclContext Context(Using);
 Context.UsingDeclRange = CharSourceRange::getCharRange(
 Using->getLocStart(),
___
cfe-commits mailing list
cfe-commits@lists.llv

Re: [PATCH] D20519: [clang-tidy] Ignore ADL-style using decls in unused-using-decls check.

2016-05-26 Thread Haojian Wu via cfe-commits
hokein added inline comments.


Comment at: clang-tidy/misc/UnusedUsingDeclsCheck.cpp:47
@@ +46,3 @@
+  return;
+// Ignores using-declarations defined in function definitions to avoid
+// arguement-dependent lookup.

alexfh wrote:
> hokein wrote:
> > alexfh wrote:
> > > I don't think using declarations in functions are inherently related to 
> > > ADL. This check doesn't seem like a useful heuristic.
> > Yeah, the current work around is only to ignore all using-decls in function 
> > context which is not perfect. I didn't find out a better way.
> If we're talking about this pattern:
> 
>   using std::swap;
>   ...
>   ::ns::T x, y;
>   swap(x, y); // ::ns::swap() is used
> 
> then for each function name resolved using ADL, we can find all using 
> declarations for the same name in different namespaces and mark them used. 
> WDYT?
Great, this idea looks good to me. Will make the change.


http://reviews.llvm.org/D20519



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


RE: r270822 - [OPENMP] Set '_OPENMP' macro to '201511' value to reflect support for

2016-05-26 Thread Hahnfeld, Jonas via cfe-commits
Hi Alexey,

I don't really know whether this is correct. IMO this may only be set once 
OpenMP 4.5 is fully supported.
This currently isn't even the case for OpenMP 4.0 as at least support for 
#pragma omp target update has not yet been committed.

In my understanding the macro may be used for feature tests. That's what we 
tried to do within the ompt.h header and we had to add an exception because 
Clang 3.8 reported 201307 but didn't support #pragma omp declare target (which 
it only recently gained).
Would you be ok reverting this commit?

Cheers,
Jonas

> -Original Message-
> From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf
> Of Alexey Bataev via cfe-commits
> Sent: Thursday, May 26, 2016 6:56 AM
> To: cfe-commits@lists.llvm.org
> Subject: r270822 - [OPENMP] Set '_OPENMP' macro to '201511' value to
> reflect support for
>
> Author: abataev
> Date: Wed May 25 23:56:05 2016
> New Revision: 270822
>
> URL: http://llvm.org/viewvc/llvm-project?rev=270822&view=rev
> Log:
> [OPENMP] Set '_OPENMP' macro to '201511' value to reflect support for
> OpenMP 4.5.
>
> According to OpenMP 4.5 the _OPENMP macro name is defined to have the
> decimal value mm where  and mm are the year and month
> designations of the version of the OpenMP API that the implementation
> supports. Clang supports OpenMP 4.5 so updated value of _OPENMP macro
> to 201511.
>
> Modified:
> cfe/trunk/lib/Frontend/InitPreprocessor.cpp
> cfe/trunk/test/OpenMP/predefined_macro.c
>
> Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp
> URL: http://llvm.org/viewvc/llvm-
> project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=270822&r1=27082
> 1&r2=270822&view=diff
> ==
> 
> --- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original)
> +++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Wed May 25 23:56:05 2016
> @@ -928,7 +928,7 @@ static void InitializePredefinedMacros(c
>  //   macro name is defined to have the decimal value mm where
>  //    and mm are the year and the month designations of the
>  //   version of the OpenMP API that the implementation support.
> -Builder.defineMacro("_OPENMP", "201307");
> +Builder.defineMacro("_OPENMP", "201511");
>}
>
>// CUDA device path compilaton
>
> Modified: cfe/trunk/test/OpenMP/predefined_macro.c
> URL: http://llvm.org/viewvc/llvm-
> project/cfe/trunk/test/OpenMP/predefined_macro.c?rev=270822&r1=2708
> 21&r2=270822&view=diff
> ==
> 
> --- cfe/trunk/test/OpenMP/predefined_macro.c (original)
> +++ cfe/trunk/test/OpenMP/predefined_macro.c Wed May 25 23:56:05 2016
> @@ -5,7 +5,7 @@
>  // -fopenmp option is specified
>  #ifndef _OPENMP
>  #error "No _OPENMP macro is defined with -fopenmp option"
> -#elsif _OPENMP != 201307
> +#elsif _OPENMP != 201511
>  #error "_OPENMP has incorrect value"
>  #endif //_OPENMP
>  #else
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


smime.p7s
Description: S/MIME cryptographic signature
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r270822 - [OPENMP] Set '_OPENMP' macro to '201511' value to reflect support for

2016-05-26 Thread Alexey Bataev via cfe-commits
Hi,

I thought about this. Will it be good for you if I add and option 
'-fopenmp-version=[31|40|45]', which will allow you to choose the 
supported version? For now it will just modify the value of _OPENMP, 
later support can be extended for better compatibility.

Best regards,
Alexey Bataev
=
Software Engineer
Intel Compiler Team

26.05.2016 10:46, Hahnfeld, Jonas пишет:
> Hi Alexey,
>
> I don't really know whether this is correct. IMO this may only be set once
> OpenMP 4.5 is fully supported.
> This currently isn't even the case for OpenMP 4.0 as at least support for
> #pragma omp target update has not yet been committed.
>
> In my understanding the macro may be used for feature tests. That's what we
> tried to do within the ompt.h header and we had to add an exception because
> Clang 3.8 reported 201307 but didn't support #pragma omp declare target (which
> it only recently gained).
> Would you be ok reverting this commit?
>
> Cheers,
> Jonas
>
>> -Original Message-
>> From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf
>> Of Alexey Bataev via cfe-commits
>> Sent: Thursday, May 26, 2016 6:56 AM
>> To: cfe-commits@lists.llvm.org
>> Subject: r270822 - [OPENMP] Set '_OPENMP' macro to '201511' value to
>> reflect support for
>>
>> Author: abataev
>> Date: Wed May 25 23:56:05 2016
>> New Revision: 270822
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=270822&view=rev
>> Log:
>> [OPENMP] Set '_OPENMP' macro to '201511' value to reflect support for
>> OpenMP 4.5.
>>
>> According to OpenMP 4.5 the _OPENMP macro name is defined to have the
>> decimal value mm where  and mm are the year and month
>> designations of the version of the OpenMP API that the implementation
>> supports. Clang supports OpenMP 4.5 so updated value of _OPENMP macro
>> to 201511.
>>
>> Modified:
>>  cfe/trunk/lib/Frontend/InitPreprocessor.cpp
>>  cfe/trunk/test/OpenMP/predefined_macro.c
>>
>> Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp
>> URL: http://llvm.org/viewvc/llvm-
>> project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=270822&r1=27082
>> 1&r2=270822&view=diff
>> ==
>> 
>> --- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original)
>> +++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Wed May 25 23:56:05 2016
>> @@ -928,7 +928,7 @@ static void InitializePredefinedMacros(c
>>   //   macro name is defined to have the decimal value mm where
>>   //    and mm are the year and the month designations of the
>>   //   version of the OpenMP API that the implementation support.
>> -Builder.defineMacro("_OPENMP", "201307");
>> +Builder.defineMacro("_OPENMP", "201511");
>> }
>>
>> // CUDA device path compilaton
>>
>> Modified: cfe/trunk/test/OpenMP/predefined_macro.c
>> URL: http://llvm.org/viewvc/llvm-
>> project/cfe/trunk/test/OpenMP/predefined_macro.c?rev=270822&r1=2708
>> 21&r2=270822&view=diff
>> ==
>> 
>> --- cfe/trunk/test/OpenMP/predefined_macro.c (original)
>> +++ cfe/trunk/test/OpenMP/predefined_macro.c Wed May 25 23:56:05 2016
>> @@ -5,7 +5,7 @@
>>   // -fopenmp option is specified
>>   #ifndef _OPENMP
>>   #error "No _OPENMP macro is defined with -fopenmp option"
>> -#elsif _OPENMP != 201307
>> +#elsif _OPENMP != 201511
>>   #error "_OPENMP has incorrect value"
>>   #endif //_OPENMP
>>   #else
>>
>>
>> ___
>> cfe-commits mailing list
>> cfe-commits@lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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


Re: r270373 - [driver][mips] Support new versions of MIPS CodeScape toolchains

2016-05-26 Thread Ismail Donmez via cfe-commits
Hi,

I think this is because I enable libc++ by default with
-DLLVM_ENABLE_LIBCXX=ON , so this tests need an explicit
-stdlib=libstdc++

ismail


On Thu, May 26, 2016 at 10:08 AM, Simon Atanasyan  wrote:
> I'm trying to reproduce the problem but without success yet. And all
> buildbots available to me are green. So no ideas right now.
>
> By the way, as far as I can see you use some sort of build system
> probably to get rpm package. Right? Could you try to build Clang by
> hand (http://clang.llvm.org/get_started.html) and run the tests. Is
> the problem reproduced in that case?
>
> On Thu, May 26, 2016 at 10:01 AM, Ismail Donmez  wrote:
>> Any ideas what's going on?
>>
>> On Wed, May 25, 2016 at 1:35 PM, Ismail Donmez  wrote:
>>> Hi,
>>>
>>> On Wed, May 25, 2016 at 1:32 PM, Simon Atanasyan  
>>> wrote:
 Hi,

 Thanks for the information. One more question. Does the following folder 
 exist?

 /home/abuild/rpmbuild/BUILD/llvm/tools/clang/test/Driver/Inputs/mips_img_v2_tree/lib/gcc/mips-img-linux-gnu/4.9.2/../../../../mips-img-linux-gnu/include/c++/4.9.2

>>>
>>> Yes :
>>>
>>> :/ # ls 
>>> /home/abuild/rpmbuild/BUILD/llvm/tools/clang/test/Driver/Inputs/mips_img_v2_tree/lib/gcc/mips-img-linux-gnu/4.9.2/../../../../mips-img-linux-gnu/include/c++/4.9.2
>>> mips-img-linux-gnu
>
> --
> Simon
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


RE: r270822 - [OPENMP] Set '_OPENMP' macro to '201511' value to reflect support for

2016-05-26 Thread Hahnfeld, Jonas via cfe-commits
Hi Alexey,

If this defaults to the currently completely supported version (I think 4.0 
when target update gets committed), that would be great. That way, the user 
would have to explicitly request the newer (and possibly incomplete) version.

Greetings,
Jonas

> -Original Message-
> From: Alexey Bataev [mailto:a.bat...@hotmail.com]
> Sent: Thursday, May 26, 2016 9:57 AM
> To: Hahnfeld, Jonas
> Cc: cfe-commits@lists.llvm.org; Samuel F Antao
> Subject: Re: r270822 - [OPENMP] Set '_OPENMP' macro to '201511' value to
> reflect support for
> 
> Hi,
> 
> I thought about this. Will it be good for you if I add and option '-fopenmp-
> version=[31|40|45]', which will allow you to choose the supported version?
> For now it will just modify the value of _OPENMP, later support can be
> extended for better compatibility.
> 
> Best regards,
> Alexey Bataev
> =
> Software Engineer
> Intel Compiler Team
> 
> 26.05.2016 10:46, Hahnfeld, Jonas пишет:
> > Hi Alexey,
> >
> > I don't really know whether this is correct. IMO this may only be set
> > once OpenMP 4.5 is fully supported.
> > This currently isn't even the case for OpenMP 4.0 as at least support
> > for #pragma omp target update has not yet been committed.
> >
> > In my understanding the macro may be used for feature tests. That's
> > what we tried to do within the ompt.h header and we had to add an
> > exception because Clang 3.8 reported 201307 but didn't support #pragma
> > omp declare target (which it only recently gained).
> > Would you be ok reverting this commit?
> >
> > Cheers,
> > Jonas
> >
> >> -Original Message-
> >> From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On
> >> Behalf Of Alexey Bataev via cfe-commits
> >> Sent: Thursday, May 26, 2016 6:56 AM
> >> To: cfe-commits@lists.llvm.org
> >> Subject: r270822 - [OPENMP] Set '_OPENMP' macro to '201511' value to
> >> reflect support for
> >>
> >> Author: abataev
> >> Date: Wed May 25 23:56:05 2016
> >> New Revision: 270822
> >>
> >> URL: http://llvm.org/viewvc/llvm-project?rev=270822&view=rev
> >> Log:
> >> [OPENMP] Set '_OPENMP' macro to '201511' value to reflect support for
> >> OpenMP 4.5.
> >>
> >> According to OpenMP 4.5 the _OPENMP macro name is defined to have
> the
> >> decimal value mm where  and mm are the year and month
> >> designations of the version of the OpenMP API that the implementation
> >> supports. Clang supports OpenMP 4.5 so updated value of _OPENMP
> macro
> >> to 201511.
> >>
> >> Modified:
> >>  cfe/trunk/lib/Frontend/InitPreprocessor.cpp
> >>  cfe/trunk/test/OpenMP/predefined_macro.c
> >>
> >> Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp
> >> URL: http://llvm.org/viewvc/llvm-
> >>
> project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=270822&r1=270
> >> 82
> >> 1&r2=270822&view=diff
> >>
> ==
> >> 
> >> --- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original)
> >> +++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Wed May 25 23:56:05
> >> +++ 2016
> >> @@ -928,7 +928,7 @@ static void InitializePredefinedMacros(c
> >>   //   macro name is defined to have the decimal value mm where
> >>   //    and mm are the year and the month designations of the
> >>   //   version of the OpenMP API that the implementation support.
> >> -Builder.defineMacro("_OPENMP", "201307");
> >> +Builder.defineMacro("_OPENMP", "201511");
> >> }
> >>
> >> // CUDA device path compilaton
> >>
> >> Modified: cfe/trunk/test/OpenMP/predefined_macro.c
> >> URL: http://llvm.org/viewvc/llvm-
> >>
> project/cfe/trunk/test/OpenMP/predefined_macro.c?rev=270822&r1=2708
> >> 21&r2=270822&view=diff
> >>
> ==
> >> 
> >> --- cfe/trunk/test/OpenMP/predefined_macro.c (original)
> >> +++ cfe/trunk/test/OpenMP/predefined_macro.c Wed May 25 23:56:05
> 2016
> >> @@ -5,7 +5,7 @@
> >>   // -fopenmp option is specified
> >>   #ifndef _OPENMP
> >>   #error "No _OPENMP macro is defined with -fopenmp option"
> >> -#elsif _OPENMP != 201307
> >> +#elsif _OPENMP != 201511
> >>   #error "_OPENMP has incorrect value"
> >>   #endif //_OPENMP
> >>   #else
> >>
> >>
> >> ___
> >> cfe-commits mailing list
> >> cfe-commits@lists.llvm.org
> >> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits



smime.p7s
Description: S/MIME cryptographic signature
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2016-05-26 Thread İsmail Dönmez via cfe-commits
ismail added a subscriber: ismail.
ismail added a comment.

Richard,

Does this mean this feature will never be accepted? It would help to make a 
clear statement on this issue. I am not happy how this feature is introduced 
but it's too late now that every big Linux distro out there switched to the new 
ABI.


http://reviews.llvm.org/D18035



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


r270830 - Fix instrinsics names:

2016-05-26 Thread Michael Zuckerman via cfe-commits
Author: mzuckerm
Date: Thu May 26 03:10:12 2016
New Revision: 270830

URL: http://llvm.org/viewvc/llvm-project?rev=270830&view=rev
Log:
Fix instrinsics names: 
_mm128_cmp_ps_mask-->_mm_cmp_ps_mask
_mm128_mask_cmp_ps_mask-->_mm_mask_cmp_ps_mask
_mm128_cmp_pd_mask-->_mm_cmp_pd_mask
_mm128_mask_cmp_pd_mask-->_mm_mask_cmp_pd_mask



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

Modified: cfe/trunk/lib/Headers/avx512vlintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512vlintrin.h?rev=270830&r1=270829&r2=270830&view=diff
==
--- cfe/trunk/lib/Headers/avx512vlintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512vlintrin.h Thu May 26 03:10:12 2016
@@ -1302,22 +1302,22 @@ _mm_maskz_xor_epi64 (__mmask8 __U, __m12
  (__v4df)(__m256d)(b), (int)(p), \
  (__mmask8)(m)); })
 
-#define _mm128_cmp_ps_mask(a, b, p)  __extension__ ({ \
+#define _mm_cmp_ps_mask(a, b, p)  __extension__ ({ \
   (__mmask8)__builtin_ia32_cmpps128_mask((__v4sf)(__m128)(a), \
  (__v4sf)(__m128)(b), (int)(p), \
  (__mmask8)-1); })
 
-#define _mm128_mask_cmp_ps_mask(m, a, b, p)  __extension__ ({ \
+#define _mm_mask_cmp_ps_mask(m, a, b, p)  __extension__ ({ \
   (__mmask8)__builtin_ia32_cmpps128_mask((__v4sf)(__m128)(a), \
  (__v4sf)(__m128)(b), (int)(p), \
  (__mmask8)(m)); })
 
-#define _mm128_cmp_pd_mask(a, b, p)  __extension__ ({ \
+#define _mm_cmp_pd_mask(a, b, p)  __extension__ ({ \
   (__mmask8)__builtin_ia32_cmppd128_mask((__v2df)(__m128d)(a), \
  (__v2df)(__m128d)(b), (int)(p), \
  (__mmask8)-1); })
 
-#define _mm128_mask_cmp_pd_mask(m, a, b, p)  __extension__ ({ \
+#define _mm_mask_cmp_pd_mask(m, a, b, p)  __extension__ ({ \
   (__mmask8)__builtin_ia32_cmppd128_mask((__v2df)(__m128d)(a), \
  (__v2df)(__m128d)(b), (int)(p), \
  (__mmask8)(m)); })

Modified: cfe/trunk/test/CodeGen/avx512vl-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512vl-builtins.c?rev=270830&r1=270829&r2=270830&view=diff
==
--- cfe/trunk/test/CodeGen/avx512vl-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx512vl-builtins.c Thu May 26 03:10:12 2016
@@ -993,16 +993,16 @@ __mmask8 test_mm256_mask_cmp_ps_mask(__m
   return _mm256_mask_cmp_ps_mask(m, __A, __B, 0);
 }
 
-__mmask8 test_mm128_cmp_ps_mask(__m128 __A, __m128 __B) {
-  // CHECK-LABEL: @test_mm128_cmp_ps_mask
+__mmask8 test_mm_cmp_ps_mask(__m128 __A, __m128 __B) {
+  // CHECK-LABEL: @test_mm_cmp_ps_mask
   // CHECK: @llvm.x86.avx512.mask.cmp.ps.128
-  return (__mmask8)_mm128_cmp_ps_mask(__A, __B, 0);
+  return (__mmask8)_mm_cmp_ps_mask(__A, __B, 0);
 }
 
-__mmask8 test_mm128_mask_cmp_ps_mask(__mmask8 m, __m128 __A, __m128 __B) {
-  // CHECK-LABEL: @test_mm128_mask_cmp_ps_mask
+__mmask8 test_mm_mask_cmp_ps_mask(__mmask8 m, __m128 __A, __m128 __B) {
+  // CHECK-LABEL: @test_mm_mask_cmp_ps_mask
   // CHECK: @llvm.x86.avx512.mask.cmp.ps.128
-  return _mm128_mask_cmp_ps_mask(m, __A, __B, 0);
+  return _mm_mask_cmp_ps_mask(m, __A, __B, 0);
 }
 
 __mmask8 test_mm256_cmp_pd_mask(__m256d __A, __m256d __B) {
@@ -1017,21 +1017,18 @@ __mmask8 test_mm256_mask_cmp_pd_mask(__m
   return _mm256_mask_cmp_pd_mask(m, __A, __B, 0);
 }
 
-__mmask8 test_mm128_cmp_pd_mask(__m128d __A, __m128d __B) {
-  // CHECK-LABEL: @test_mm128_cmp_pd_mask
+__mmask8 test_mm_cmp_pd_mask(__m128d __A, __m128d __B) {
+  // CHECK-LABEL: @test_mm_cmp_pd_mask
   // CHECK: @llvm.x86.avx512.mask.cmp.pd.128
-  return (__mmask8)_mm128_cmp_pd_mask(__A, __B, 0);
+  return (__mmask8)_mm_cmp_pd_mask(__A, __B, 0);
 }
 
-__mmask8 test_mm128_mask_cmp_pd_mask(__mmask8 m, __m128d __A, __m128d __B) {
-  // CHECK-LABEL: @test_mm128_mask_cmp_pd_mask
+__mmask8 test_mm_mask_cmp_pd_mask(__mmask8 m, __m128d __A, __m128d __B) {
+  // CHECK-LABEL: @test_mm_mask_cmp_pd_mask
   // CHECK: @llvm.x86.avx512.mask.cmp.pd.128
-  return _mm128_mask_cmp_pd_mask(m, __A, __B, 0);
+  return _mm_mask_cmp_pd_mask(m, __A, __B, 0);
 }
 
-
-//igorb
-
 __m128d test_mm_mask_fmadd_pd(__m128d __A, __mmask8 __U, __m128d __B, __m128d 
__C) {
   // CHECK-LABEL: @test_mm_mask_fmadd_pd
   // CHECK: @llvm.x86.avx512.mask.vfmadd.pd.128


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


RE: r270373 - [driver][mips] Support new versions of MIPS CodeScape toolchains

2016-05-26 Thread Hahnfeld, Jonas via cfe-commits
Hi,

Have you also set CLANG_DEFAULT_CXX_STDLIB? Then you may need to add an 
'-stdlib=platform' to the test... (see r260662 and r263434)

Cheers,
Jonas

> -Original Message-
> From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf
> Of Ismail Donmez via cfe-commits
> Sent: Thursday, May 26, 2016 10:03 AM
> To: Simon Atanasyan
> Cc: cfe-commits
> Subject: Re: r270373 - [driver][mips] Support new versions of MIPS
> CodeScape toolchains
>
> Hi,
>
> I think this is because I enable libc++ by default with -
> DLLVM_ENABLE_LIBCXX=ON , so this tests need an explicit -stdlib=libstdc++
>
> ismail
>
>
> On Thu, May 26, 2016 at 10:08 AM, Simon Atanasyan
>  wrote:
> > I'm trying to reproduce the problem but without success yet. And all
> > buildbots available to me are green. So no ideas right now.
> >
> > By the way, as far as I can see you use some sort of build system
> > probably to get rpm package. Right? Could you try to build Clang by
> > hand (http://clang.llvm.org/get_started.html) and run the tests. Is
> > the problem reproduced in that case?
> >
> > On Thu, May 26, 2016 at 10:01 AM, Ismail Donmez 
> wrote:
> >> Any ideas what's going on?
> >>
> >> On Wed, May 25, 2016 at 1:35 PM, Ismail Donmez 
> wrote:
> >>> Hi,
> >>>
> >>> On Wed, May 25, 2016 at 1:32 PM, Simon Atanasyan
>  wrote:
>  Hi,
> 
>  Thanks for the information. One more question. Does the following
> folder exist?
> 
> 
> /home/abuild/rpmbuild/BUILD/llvm/tools/clang/test/Driver/Inputs/mip
>  s_img_v2_tree/lib/gcc/mips-img-linux-gnu/4.9.2/../../../../mips-img
>  -linux-gnu/include/c++/4.9.2
> 
> >>>
> >>> Yes :
> >>>
> >>> :/ # ls
> >>>
> /home/abuild/rpmbuild/BUILD/llvm/tools/clang/test/Driver/Inputs/mips
> >>> _img_v2_tree/lib/gcc/mips-img-linux-gnu/4.9.2/../../../../mips-img-l
> >>> inux-gnu/include/c++/4.9.2
> >>> mips-img-linux-gnu
> >
> > --
> > Simon
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


smime.p7s
Description: S/MIME cryptographic signature
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r270373 - [driver][mips] Support new versions of MIPS CodeScape toolchains

2016-05-26 Thread Simon Atanasyan via cfe-commits
Sounds reasonable. I will check this idea and fix the tests accordingly.
On May 26, 2016 11:03 AM, "Ismail Donmez"  wrote:

> Hi,
>
> I think this is because I enable libc++ by default with
> -DLLVM_ENABLE_LIBCXX=ON , so this tests need an explicit
> -stdlib=libstdc++
>
> ismail
>
>
> On Thu, May 26, 2016 at 10:08 AM, Simon Atanasyan 
> wrote:
> > I'm trying to reproduce the problem but without success yet. And all
> > buildbots available to me are green. So no ideas right now.
> >
> > By the way, as far as I can see you use some sort of build system
> > probably to get rpm package. Right? Could you try to build Clang by
> > hand (http://clang.llvm.org/get_started.html) and run the tests. Is
> > the problem reproduced in that case?
> >
> > On Thu, May 26, 2016 at 10:01 AM, Ismail Donmez  wrote:
> >> Any ideas what's going on?
> >>
> >> On Wed, May 25, 2016 at 1:35 PM, Ismail Donmez  wrote:
> >>> Hi,
> >>>
> >>> On Wed, May 25, 2016 at 1:32 PM, Simon Atanasyan 
> wrote:
>  Hi,
> 
>  Thanks for the information. One more question. Does the following
> folder exist?
> 
> 
> /home/abuild/rpmbuild/BUILD/llvm/tools/clang/test/Driver/Inputs/mips_img_v2_tree/lib/gcc/mips-img-linux-gnu/4.9.2/../../../../mips-img-linux-gnu/include/c++/4.9.2
> 
> >>>
> >>> Yes :
> >>>
> >>> :/ # ls
> /home/abuild/rpmbuild/BUILD/llvm/tools/clang/test/Driver/Inputs/mips_img_v2_tree/lib/gcc/mips-img-linux-gnu/4.9.2/../../../../mips-img-linux-gnu/include/c++/4.9.2
> >>> mips-img-linux-gnu
> >
> > --
> > Simon
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r270822 - [OPENMP] Set '_OPENMP' macro to '201511' value to reflect support for

2016-05-26 Thread Alexey Bataev via cfe-commits
Ok, will default it to 3.1 for now.

Best regards,
Alexey Bataev
=
Software Engineer
Intel Compiler Team

26.05.2016 11:09, Hahnfeld, Jonas пишет:
> Hi Alexey,
>
> If this defaults to the currently completely supported version (I think 4.0 
> when target update gets committed), that would be great. That way, the user 
> would have to explicitly request the newer (and possibly incomplete) version.
>
> Greetings,
> Jonas
>
>> -Original Message-
>> From: Alexey Bataev [mailto:a.bat...@hotmail.com]
>> Sent: Thursday, May 26, 2016 9:57 AM
>> To: Hahnfeld, Jonas
>> Cc: cfe-commits@lists.llvm.org; Samuel F Antao
>> Subject: Re: r270822 - [OPENMP] Set '_OPENMP' macro to '201511' value to
>> reflect support for
>>
>> Hi,
>>
>> I thought about this. Will it be good for you if I add and option '-fopenmp-
>> version=[31|40|45]', which will allow you to choose the supported version?
>> For now it will just modify the value of _OPENMP, later support can be
>> extended for better compatibility.
>>
>> Best regards,
>> Alexey Bataev
>> =
>> Software Engineer
>> Intel Compiler Team
>>
>> 26.05.2016 10:46, Hahnfeld, Jonas пишет:
>>> Hi Alexey,
>>>
>>> I don't really know whether this is correct. IMO this may only be set
>>> once OpenMP 4.5 is fully supported.
>>> This currently isn't even the case for OpenMP 4.0 as at least support
>>> for #pragma omp target update has not yet been committed.
>>>
>>> In my understanding the macro may be used for feature tests. That's
>>> what we tried to do within the ompt.h header and we had to add an
>>> exception because Clang 3.8 reported 201307 but didn't support #pragma
>>> omp declare target (which it only recently gained).
>>> Would you be ok reverting this commit?
>>>
>>> Cheers,
>>> Jonas
>>>
 -Original Message-
 From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On
 Behalf Of Alexey Bataev via cfe-commits
 Sent: Thursday, May 26, 2016 6:56 AM
 To: cfe-commits@lists.llvm.org
 Subject: r270822 - [OPENMP] Set '_OPENMP' macro to '201511' value to
 reflect support for

 Author: abataev
 Date: Wed May 25 23:56:05 2016
 New Revision: 270822

 URL: http://llvm.org/viewvc/llvm-project?rev=270822&view=rev
 Log:
 [OPENMP] Set '_OPENMP' macro to '201511' value to reflect support for
 OpenMP 4.5.

 According to OpenMP 4.5 the _OPENMP macro name is defined to have
>> the
 decimal value mm where  and mm are the year and month
 designations of the version of the OpenMP API that the implementation
 supports. Clang supports OpenMP 4.5 so updated value of _OPENMP
>> macro
 to 201511.

 Modified:
   cfe/trunk/lib/Frontend/InitPreprocessor.cpp
   cfe/trunk/test/OpenMP/predefined_macro.c

 Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp
 URL: http://llvm.org/viewvc/llvm-

>> project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=270822&r1=270
 82
 1&r2=270822&view=diff

>> ==
 
 --- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original)
 +++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Wed May 25 23:56:05
 +++ 2016
 @@ -928,7 +928,7 @@ static void InitializePredefinedMacros(c
//   macro name is defined to have the decimal value mm where
//    and mm are the year and the month designations of the
//   version of the OpenMP API that the implementation support.
 -Builder.defineMacro("_OPENMP", "201307");
 +Builder.defineMacro("_OPENMP", "201511");
  }

  // CUDA device path compilaton

 Modified: cfe/trunk/test/OpenMP/predefined_macro.c
 URL: http://llvm.org/viewvc/llvm-

>> project/cfe/trunk/test/OpenMP/predefined_macro.c?rev=270822&r1=2708
 21&r2=270822&view=diff

>> ==
 
 --- cfe/trunk/test/OpenMP/predefined_macro.c (original)
 +++ cfe/trunk/test/OpenMP/predefined_macro.c Wed May 25 23:56:05
>> 2016
 @@ -5,7 +5,7 @@
// -fopenmp option is specified
#ifndef _OPENMP
#error "No _OPENMP macro is defined with -fopenmp option"
 -#elsif _OPENMP != 201307
 +#elsif _OPENMP != 201511
#error "_OPENMP has incorrect value"
#endif //_OPENMP
#else


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

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


Re: r270373 - [driver][mips] Support new versions of MIPS CodeScape toolchains

2016-05-26 Thread Ismail Donmez via cfe-commits
Indeed the problematic option is -DCLANG_DEFAULT_CXX_STDLIB=libc++ ,
thanks Jonas!

On Thu, May 26, 2016 at 11:19 AM, Hahnfeld, Jonas
 wrote:
> Hi,
>
> Have you also set CLANG_DEFAULT_CXX_STDLIB? Then you may need to add an
> '-stdlib=platform' to the test... (see r260662 and r263434)
>
> Cheers,
> Jonas
>
>> -Original Message-
>> From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf
>> Of Ismail Donmez via cfe-commits
>> Sent: Thursday, May 26, 2016 10:03 AM
>> To: Simon Atanasyan
>> Cc: cfe-commits
>> Subject: Re: r270373 - [driver][mips] Support new versions of MIPS
>> CodeScape toolchains
>>
>> Hi,
>>
>> I think this is because I enable libc++ by default with -
>> DLLVM_ENABLE_LIBCXX=ON , so this tests need an explicit -stdlib=libstdc++
>>
>> ismail
>>
>>
>> On Thu, May 26, 2016 at 10:08 AM, Simon Atanasyan
>>  wrote:
>> > I'm trying to reproduce the problem but without success yet. And all
>> > buildbots available to me are green. So no ideas right now.
>> >
>> > By the way, as far as I can see you use some sort of build system
>> > probably to get rpm package. Right? Could you try to build Clang by
>> > hand (http://clang.llvm.org/get_started.html) and run the tests. Is
>> > the problem reproduced in that case?
>> >
>> > On Thu, May 26, 2016 at 10:01 AM, Ismail Donmez 
>> wrote:
>> >> Any ideas what's going on?
>> >>
>> >> On Wed, May 25, 2016 at 1:35 PM, Ismail Donmez 
>> wrote:
>> >>> Hi,
>> >>>
>> >>> On Wed, May 25, 2016 at 1:32 PM, Simon Atanasyan
>>  wrote:
>>  Hi,
>> 
>>  Thanks for the information. One more question. Does the following
>> folder exist?
>> 
>> 
>> /home/abuild/rpmbuild/BUILD/llvm/tools/clang/test/Driver/Inputs/mip
>>  s_img_v2_tree/lib/gcc/mips-img-linux-gnu/4.9.2/../../../../mips-img
>>  -linux-gnu/include/c++/4.9.2
>> 
>> >>>
>> >>> Yes :
>> >>>
>> >>> :/ # ls
>> >>>
>> /home/abuild/rpmbuild/BUILD/llvm/tools/clang/test/Driver/Inputs/mips
>> >>> _img_v2_tree/lib/gcc/mips-img-linux-gnu/4.9.2/../../../../mips-img-l
>> >>> inux-gnu/include/c++/4.9.2
>> >>> mips-img-linux-gnu
>> >
>> > --
>> > Simon
>> ___
>> cfe-commits mailing list
>> cfe-commits@lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20437: [MSVC] Support of __unaligned qualifier for function types

2016-05-26 Thread Andrey Bokhanko via cfe-commits
andreybokhanko marked 3 inline comments as done.


Comment at: lib/Sema/SemaExprCXX.cpp:937
@@ -936,2 +936,3 @@
 
+  CXXThisTypeQuals &= Qualifiers::FastMask;
   S.CXXThisTypeOverride

majnemer wrote:
> Can you add a comment for this line.
Done.

Thank you for the review!


http://reviews.llvm.org/D20437



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


r270833 - [X86][AVX2] Improved checks for float/double mask generation for non-masked gathers

2016-05-26 Thread Simon Pilgrim via cfe-commits
Author: rksimon
Date: Thu May 26 04:56:50 2016
New Revision: 270833

URL: http://llvm.org/viewvc/llvm-project?rev=270833&view=rev
Log:
[X86][AVX2] Improved checks for float/double mask generation for non-masked 
gathers

Modified:
cfe/trunk/test/CodeGen/avx2-builtins.c

Modified: cfe/trunk/test/CodeGen/avx2-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx2-builtins.c?rev=270833&r1=270832&r2=270833&view=diff
==
--- cfe/trunk/test/CodeGen/avx2-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx2-builtins.c Thu May 26 04:56:50 2016
@@ -467,6 +467,7 @@ __m256i test_mm256_mask_i32gather_epi64(
 
 __m128d test_mm_i32gather_pd(double const *b, __m128i c) {
   // CHECK-LABEL: test_mm_i32gather_pd
+  // CHECK: call <2 x double> @llvm.x86.sse2.cmp.pd(<2 x double> %{{.*}}, <2 x 
double> %{{.*}}, i8 0)
   // CHECK: call <2 x double> @llvm.x86.avx2.gather.d.pd(<2 x double> undef, 
i8* %{{.*}}, <4 x i32> %{{.*}}, <2 x double> %{{.*}}, i8 2)
   return _mm_i32gather_pd(b, c, 2);
 }
@@ -479,6 +480,7 @@ __m128d test_mm_mask_i32gather_pd(__m128
 
 __m256d test_mm256_i32gather_pd(double const *b, __m128i c) {
   // CHECK-LABEL: test_mm256_i32gather_pd
+  // CHECK: call <4 x double> @llvm.x86.avx.cmp.pd.256(<4 x double> %{{.*}}, 
<4 x double> %{{.*}}, i8 0)
   // CHECK: call <4 x double> @llvm.x86.avx2.gather.d.pd.256(<4 x double> 
undef, i8* %{{.*}}, <4 x i32> %{{.*}}, <4 x double> %{{.*}}, i8 2)
   return _mm256_i32gather_pd(b, c, 2);
 }
@@ -491,6 +493,7 @@ __m256d test_mm256_mask_i32gather_pd(__m
 
 __m128 test_mm_i32gather_ps(float const *b, __m128i c) {
   // CHECK-LABEL: test_mm_i32gather_ps
+  // CHECK: call <4 x float> @llvm.x86.sse.cmp.ps(<4 x float> %{{.*}}, <4 x 
float> %{{.*}}, i8 0)
   // CHECK: call <4 x float> @llvm.x86.avx2.gather.d.ps(<4 x float> undef, i8* 
%{{.*}}, <4 x i32> %{{.*}}, <4 x float> %{{.*}}, i8 2)
   return _mm_i32gather_ps(b, c, 2);
 }
@@ -503,6 +506,7 @@ __m128 test_mm_mask_i32gather_ps(__m128
 
 __m256 test_mm256_i32gather_ps(float const *b, __m256i c) {
   // CHECK-LABEL: test_mm256_i32gather_ps
+  // CHECK: call <8 x float> @llvm.x86.avx.cmp.ps.256(<8 x float> %{{.*}}, <8 
x float> %{{.*}}, i8 0)
   // CHECK: call <8 x float> @llvm.x86.avx2.gather.d.ps.256(<8 x float> undef, 
i8* %{{.*}}, <8 x i32> %{{.*}}, <8 x float> %{{.*}}, i8 2)
   return _mm256_i32gather_ps(b, c, 2);
 }
@@ -563,6 +567,7 @@ __m256i test_mm256_mask_i64gather_epi64(
 
 __m128d test_mm_i64gather_pd(double const *b, __m128i c) {
   // CHECK-LABEL: test_mm_i64gather_pd
+  // CHECK: call <2 x double> @llvm.x86.sse2.cmp.pd(<2 x double> %{{.*}}, <2 x 
double> %{{.*}}, i8 0)
   // CHECK: call <2 x double> @llvm.x86.avx2.gather.q.pd(<2 x double> undef, 
i8* %{{.*}}, <2 x i64> %{{.*}}, <2 x double> %{{.*}}, i8 2)
   return _mm_i64gather_pd(b, c, 2);
 }
@@ -575,6 +580,7 @@ __m128d test_mm_mask_i64gather_pd(__m128
 
 __m256d test_mm256_i64gather_pd(double const *b, __m256i c) {
   // CHECK-LABEL: test_mm256_i64gather_pd
+  // CHECK: call <4 x double> @llvm.x86.avx.cmp.pd.256(<4 x double> %{{.*}}, 
<4 x double> %{{.*}}, i8 0)
   // CHECK: call <4 x double> @llvm.x86.avx2.gather.q.pd.256(<4 x double> 
undef, i8* %{{.*}}, <4 x i64> %{{.*}}, <4 x double> %{{.*}}, i8 2)
   return _mm256_i64gather_pd(b, c, 2);
 }
@@ -587,6 +593,7 @@ __m256d test_mm256_mask_i64gather_pd(__m
 
 __m128 test_mm_i64gather_ps(float const *b, __m128i c) {
   // CHECK-LABEL: test_mm_i64gather_ps
+  // CHECK: call <4 x float> @llvm.x86.sse.cmp.ps(<4 x float> %{{.*}}, <4 x 
float> %{{.*}}, i8 0)
   // CHECK: call <4 x float> @llvm.x86.avx2.gather.q.ps(<4 x float> undef, i8* 
%{{.*}}, <2 x i64> %{{.*}}, <4 x float> %{{.*}}, i8 2)
   return _mm_i64gather_ps(b, c, 2);
 }
@@ -599,6 +606,7 @@ __m128 test_mm_mask_i64gather_ps(__m128
 
 __m128 test_mm256_i64gather_ps(float const *b, __m256i c) {
   // CHECK-LABEL: test_mm256_i64gather_ps
+  // CHECK: call <4 x float> @llvm.x86.sse.cmp.ps(<4 x float> %{{.*}}, <4 x 
float> %{{.*}}, i8 0)
   // CHECK: call <4 x float> @llvm.x86.avx2.gather.q.ps.256(<4 x float> undef, 
i8* %{{.*}}, <4 x i64> %{{.*}}, <4 x float> %{{.*}}, i8 2)
   return _mm256_i64gather_ps(b, c, 2);
 }


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


r270834 - [MSVC] Support for __unaligned qualifier in functions

2016-05-26 Thread Andrey Bokhanko via cfe-commits
Author: asbokhan
Date: Thu May 26 05:06:01 2016
New Revision: 270834

URL: http://llvm.org/viewvc/llvm-project?rev=270834&view=rev
Log:
[MSVC] Support for __unaligned qualifier in functions

This implements support for MS-specific __unaligned qualifier in functions and
makes the following test case both compile and mangle correctly:

struct S {
void f() __unaligned;
};
void S::f() __unaligned {
}

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

Modified:
cfe/trunk/include/clang/AST/Type.h
cfe/trunk/include/clang/Sema/DeclSpec.h
cfe/trunk/lib/AST/DeclCXX.cpp
cfe/trunk/lib/AST/MicrosoftMangle.cpp
cfe/trunk/lib/Sema/DeclSpec.cpp
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/lib/Sema/SemaType.cpp
cfe/trunk/test/CodeGenCXX/mangle-ms-cxx11.cpp
cfe/trunk/test/Sema/MicrosoftExtensions.c
cfe/trunk/test/SemaCXX/MicrosoftExtensions.cpp

Modified: cfe/trunk/include/clang/AST/Type.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=270834&r1=270833&r2=270834&view=diff
==
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Thu May 26 05:06:01 2016
@@ -215,6 +215,12 @@ public:
 return Qs;
   }
 
+  static Qualifiers fromCVRUMask(unsigned CVRU) {
+Qualifiers Qs;
+Qs.addCVRUQualifiers(CVRU);
+return Qs;
+  }
+
   // Deserialize qualifiers from an opaque representation.
   static Qualifiers fromOpaqueValue(unsigned opaque) {
 Qualifiers Qs;
@@ -265,6 +271,10 @@ public:
 assert(!(mask & ~CVRMask) && "bitmask contains non-CVR bits");
 Mask |= mask;
   }
+  void addCVRUQualifiers(unsigned mask) {
+assert(!(mask & ~CVRMask & ~UMask) && "bitmask contains non-CVRU bits");
+Mask |= mask;
+  }
 
   bool hasUnaligned() const { return Mask & UMask; }
   void setUnaligned(bool flag) {
@@ -1375,7 +1385,7 @@ protected:
 ///
 /// C++ 8.3.5p4: The return type, the parameter type list and the
 /// cv-qualifier-seq, [...], are part of the function type.
-unsigned TypeQuals : 3;
+unsigned TypeQuals : 4;
 
 /// \brief The ref-qualifier associated with a \c FunctionProtoType.
 ///

Modified: cfe/trunk/include/clang/Sema/DeclSpec.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/DeclSpec.h?rev=270834&r1=270833&r2=270834&view=diff
==
--- cfe/trunk/include/clang/Sema/DeclSpec.h (original)
+++ cfe/trunk/include/clang/Sema/DeclSpec.h Thu May 26 05:06:01 2016
@@ -311,12 +311,10 @@ public:
 TQ_const   = 1,
 TQ_restrict= 2,
 TQ_volatile= 4,
+TQ_unaligned   = 8,
 // This has no corresponding Qualifiers::TQ value, because it's not treated
 // as a qualifier in our type system.
-TQ_atomic  = 8,
-// There is no corresponding Qualifiers::TQ value, but it's kept separately
-// in a dedicated Qualifiers::Mask bit.
-TQ_unaligned   = 16
+TQ_atomic  = 16
   };
 
   /// ParsedSpecifiers - Flags to query which specifiers were applied.  This is
@@ -1120,7 +1118,7 @@ struct DeclaratorChunk {
   };
 
   struct PointerTypeInfo : TypeInfoCommon {
-/// The type qualifiers: const/volatile/restrict/atomic/unaligned.
+/// The type qualifiers: const/volatile/restrict/unaligned/atomic.
 unsigned TypeQuals : 5;
 
 /// The location of the const-qualifier, if any.
@@ -1152,8 +1150,9 @@ struct DeclaratorChunk {
   };
 
   struct ArrayTypeInfo : TypeInfoCommon {
-/// The type qualifiers for the array: const/volatile/restrict/_Atomic.
-unsigned TypeQuals : 4;
+/// The type qualifiers for the array:
+/// const/volatile/restrict/__unaligned/_Atomic.
+unsigned TypeQuals : 5;
 
 /// True if this dimension included the 'static' keyword.
 bool hasStatic : 1;
@@ -1219,9 +1218,9 @@ struct DeclaratorChunk {
 /// Otherwise, it's an rvalue reference.
 unsigned RefQualifierIsLValueRef : 1;
 
-/// The type qualifiers: const/volatile/restrict.
+/// The type qualifiers: const/volatile/restrict/__unaligned
 /// The qualifier bitmask values are the same as in QualType.
-unsigned TypeQuals : 3;
+unsigned TypeQuals : 4;
 
 /// ExceptionSpecType - An ExceptionSpecificationType value.
 unsigned ExceptionSpecType : 4;
@@ -1405,16 +1404,16 @@ struct DeclaratorChunk {
 
   struct BlockPointerTypeInfo : TypeInfoCommon {
 /// For now, sema will catch these as invalid.
-/// The type qualifiers: const/volatile/restrict/_Atomic.
-unsigned TypeQuals : 4;
+/// The type qualifiers: const/volatile/restrict/__unaligned/_Atomic.
+unsigned TypeQuals : 5;
 
 void destroy() {
 }
   };
 
   struct MemberPointerTypeInfo : TypeInfoCommon {
-/// The type qualifiers: const/volatile/restrict/_Atomic.
-unsigned TypeQuals : 4;
+/// The type qualifiers: const/volatile/restrict/__unaligned/_Atomi

Re: [PATCH] D20437: [MSVC] Support of __unaligned qualifier for function types

2016-05-26 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL270834: [MSVC] Support for __unaligned qualifier in 
functions (authored by asbokhan).

Changed prior to commit:
  http://reviews.llvm.org/D20437?vs=57907&id=58585#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20437

Files:
  cfe/trunk/include/clang/AST/Type.h
  cfe/trunk/include/clang/Sema/DeclSpec.h
  cfe/trunk/lib/AST/DeclCXX.cpp
  cfe/trunk/lib/AST/MicrosoftMangle.cpp
  cfe/trunk/lib/Sema/DeclSpec.cpp
  cfe/trunk/lib/Sema/SemaExprCXX.cpp
  cfe/trunk/lib/Sema/SemaType.cpp
  cfe/trunk/test/CodeGenCXX/mangle-ms-cxx11.cpp
  cfe/trunk/test/Sema/MicrosoftExtensions.c
  cfe/trunk/test/SemaCXX/MicrosoftExtensions.cpp

Index: cfe/trunk/lib/AST/MicrosoftMangle.cpp
===
--- cfe/trunk/lib/AST/MicrosoftMangle.cpp
+++ cfe/trunk/lib/AST/MicrosoftMangle.cpp
@@ -1447,7 +1447,8 @@
   if (HasRestrict)
 Out << 'I';
 
-  if (!PointeeType.isNull() && PointeeType.getLocalQualifiers().hasUnaligned())
+  if (Quals.hasUnaligned() ||
+  (!PointeeType.isNull() && PointeeType.getLocalQualifiers().hasUnaligned()))
 Out << 'F';
 }
 
@@ -1822,7 +1823,7 @@
   // If this is a C++ instance method, mangle the CVR qualifiers for the
   // this pointer.
   if (HasThisQuals) {
-Qualifiers Quals = Qualifiers::fromCVRMask(Proto->getTypeQuals());
+Qualifiers Quals = Qualifiers::fromCVRUMask(Proto->getTypeQuals());
 manglePointerExtQualifiers(Quals, /*PointeeType=*/QualType());
 mangleRefQualifier(Proto->getRefQualifier());
 mangleQualifiers(Quals, /*IsMember=*/false);
Index: cfe/trunk/lib/AST/DeclCXX.cpp
===
--- cfe/trunk/lib/AST/DeclCXX.cpp
+++ cfe/trunk/lib/AST/DeclCXX.cpp
@@ -1646,7 +1646,7 @@
 
   QualType ClassTy = C.getTypeDeclType(getParent());
   ClassTy = C.getQualifiedType(ClassTy,
-   Qualifiers::fromCVRMask(getTypeQualifiers()));
+   Qualifiers::fromCVRUMask(getTypeQualifiers()));
   return C.getPointerType(ClassTy);
 }
 
Index: cfe/trunk/lib/Sema/SemaExprCXX.cpp
===
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp
@@ -934,6 +934,8 @@
   else
 Record = cast(ContextDecl);
 
+  // We care only for CVR qualifiers here, so cut everything else.
+  CXXThisTypeQuals &= Qualifiers::FastMask;
   S.CXXThisTypeOverride
 = S.Context.getPointerType(
 S.Context.getRecordType(Record).withCVRQualifiers(CXXThisTypeQuals));
Index: cfe/trunk/lib/Sema/SemaType.cpp
===
--- cfe/trunk/lib/Sema/SemaType.cpp
+++ cfe/trunk/lib/Sema/SemaType.cpp
@@ -2668,8 +2668,8 @@
 { "const", DeclSpec::TQ_const, ConstQualLoc },
 { "volatile", DeclSpec::TQ_volatile, VolatileQualLoc },
 { "restrict", DeclSpec::TQ_restrict, RestrictQualLoc },
-{ "_Atomic", DeclSpec::TQ_atomic, AtomicQualLoc },
-{ "__unaligned", DeclSpec::TQ_unaligned, UnalignedQualLoc }
+{ "__unaligned", DeclSpec::TQ_unaligned, UnalignedQualLoc },
+{ "_Atomic", DeclSpec::TQ_atomic, AtomicQualLoc }
   };
 
   SmallString<32> QualStr;
Index: cfe/trunk/lib/Sema/DeclSpec.cpp
===
--- cfe/trunk/lib/Sema/DeclSpec.cpp
+++ cfe/trunk/lib/Sema/DeclSpec.cpp
@@ -796,8 +796,8 @@
   case TQ_const:TQ_constLoc = Loc; return false;
   case TQ_restrict: TQ_restrictLoc = Loc; return false;
   case TQ_volatile: TQ_volatileLoc = Loc; return false;
-  case TQ_atomic:   TQ_atomicLoc = Loc; return false;
   case TQ_unaligned: TQ_unalignedLoc = Loc; return false;
+  case TQ_atomic:   TQ_atomicLoc = Loc; return false;
   }
 
   llvm_unreachable("Unknown type qualifier!");
Index: cfe/trunk/include/clang/AST/Type.h
===
--- cfe/trunk/include/clang/AST/Type.h
+++ cfe/trunk/include/clang/AST/Type.h
@@ -215,6 +215,12 @@
 return Qs;
   }
 
+  static Qualifiers fromCVRUMask(unsigned CVRU) {
+Qualifiers Qs;
+Qs.addCVRUQualifiers(CVRU);
+return Qs;
+  }
+
   // Deserialize qualifiers from an opaque representation.
   static Qualifiers fromOpaqueValue(unsigned opaque) {
 Qualifiers Qs;
@@ -265,6 +271,10 @@
 assert(!(mask & ~CVRMask) && "bitmask contains non-CVR bits");
 Mask |= mask;
   }
+  void addCVRUQualifiers(unsigned mask) {
+assert(!(mask & ~CVRMask & ~UMask) && "bitmask contains non-CVRU bits");
+Mask |= mask;
+  }
 
   bool hasUnaligned() const { return Mask & UMask; }
   void setUnaligned(bool flag) {
@@ -1375,7 +1385,7 @@
 ///
 /// C++ 8.3.5p4: The return type, the parameter type list and the
 /// cv-qualifier-seq, [...], are part of the function type.
-unsigned TypeQuals : 3;
+unsigned TypeQuals : 4;
 
 /// \brief The ref-qualifier ass

Re: r269220 - [MSVC] Implementation of __unaligned as a proper type qualifier

2016-05-26 Thread Andrey Bokhanko via cfe-commits
This is now fixed in rL270834.

Yours,
Andrey


On Thu, May 19, 2016 at 6:34 PM, Andrey Bokhanko 
wrote:

> David,
>
> All these cases are handled properly now.
>
> Could you, please, review?
>
> http://reviews.llvm.org/D20437
>
> Yours,
> Andrey
>
>
> On Sat, May 14, 2016 at 6:11 AM, David Majnemer 
> wrote:
>
>> FYI, the following is a little shorter:
>> using Ty = int () __unaligned;
>>
>> Also, this case (in C mode) is interesting:
>> void f(int x[__unaligned 4]);
>>
>> DeclaratorChunk::getArray will truncate the TypeQuals
>> because ArrayTypeInfo's TypeQuals doesn't have enough bits.
>>
>> similar issues arise with:
>> struct A;
>>
>> void (A::*__unaligned vpa)();
>>
>> On Fri, May 13, 2016 at 4:03 PM,  wrote:
>>
>>> Hi David,
>>>
>>> Thanks for letting me know -- will investigate after the weekend.
>>>
>>> Yours,
>>> Andrey
>>>
>>> Отправлено с iPad
>>>
>>> 13 мая 2016 г., в 20:33, David Majnemer 
>>> написал(а):
>>>
>>> This seems to crash clang:
>>> struct S {
>>>   void f() __unaligned;
>>> };
>>> void S::f() __unaligned {
>>> }
>>>
>>> clang/lib/Sema/DeclSpec.cpp:214: static clang::DeclaratorChunk
>>> clang::DeclaratorChunk::getFunction(bool, bool, clang::SourceLocation,
>>> clang::DeclaratorChunk::ParamInfo *, unsigned int, clang::SourceLocation,
>>> clang::SourceLocation, unsigned int, bool, clang::SourceLocation,
>>> clang::SourceLocation, clang::SourceLocation, clang::SourceLocation,
>>> clang::SourceLocation, clang::ExceptionSpecificationType,
>>> clang::SourceRange, ParsedType *, clang::SourceRange *, unsigned int,
>>> clang::Expr *, CachedTokens *, clang::SourceLocation,
>>> clang::SourceLocation, clang::Declarator &, TypeResult): Assertion
>>> `I.Fun.TypeQuals == TypeQuals && "bitfield overflow"' failed.
>>>
>>>
>>> On Wed, May 11, 2016 at 11:38 AM, Andrey Bokhanko via cfe-commits <
>>> cfe-commits@lists.llvm.org> wrote:
>>>
 Author: asbokhan
 Date: Wed May 11 13:38:21 2016
 New Revision: 269220

 URL: http://llvm.org/viewvc/llvm-project?rev=269220&view=rev
 Log:
 [MSVC] Implementation of __unaligned as a proper type qualifier

 This patch implements __unaligned (MS extension) as a proper type
 qualifier
 (before that, it was implemented as an ignored attribute).

 It also fixes PR27367 and PR27666.

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

 Modified:
 cfe/trunk/include/clang/AST/Type.h
 cfe/trunk/include/clang/Basic/AddressSpaces.h
 cfe/trunk/include/clang/Basic/Attr.td
 cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
 cfe/trunk/include/clang/Sema/DeclSpec.h
 cfe/trunk/include/clang/Sema/Sema.h
 cfe/trunk/lib/AST/MicrosoftMangle.cpp
 cfe/trunk/lib/AST/TypePrinter.cpp
 cfe/trunk/lib/Parse/ParseDecl.cpp
 cfe/trunk/lib/Parse/ParseTentative.cpp
 cfe/trunk/lib/Sema/DeclSpec.cpp
 cfe/trunk/lib/Sema/SemaCodeComplete.cpp
 cfe/trunk/lib/Sema/SemaDecl.cpp
 cfe/trunk/lib/Sema/SemaDeclObjC.cpp
 cfe/trunk/lib/Sema/SemaExpr.cpp
 cfe/trunk/lib/Sema/SemaOverload.cpp
 cfe/trunk/lib/Sema/SemaType.cpp
 cfe/trunk/test/CodeGenCXX/mangle-ms-cxx11.cpp
 cfe/trunk/test/CodeGenCXX/mangle-ms-cxx14.cpp
 cfe/trunk/test/Sema/MicrosoftExtensions.c
 cfe/trunk/test/Sema/address_spaces.c
 cfe/trunk/test/Sema/invalid-assignment-constant-address-space.c
 cfe/trunk/test/SemaCXX/MicrosoftExtensions.cpp

 Modified: cfe/trunk/include/clang/AST/Type.h
 URL:
 http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=269220&r1=269219&r2=269220&view=diff

 ==
 --- cfe/trunk/include/clang/AST/Type.h (original)
 +++ cfe/trunk/include/clang/AST/Type.h Wed May 11 13:38:21 2016
 @@ -111,6 +111,7 @@ namespace clang {
  /// The collection of all-type qualifiers we support.
  /// Clang supports five independent qualifiers:
  /// * C99: const, volatile, and restrict
 +/// * MS: __unaligned
  /// * Embedded C (TR18037): address spaces
  /// * Objective C: the GC attributes (none, weak, or strong)
  class Qualifiers {
 @@ -152,8 +153,8 @@ public:

enum {
  /// The maximum supported address space number.
 -/// 24 bits should be enough for anyone.
 -MaxAddressSpace = 0xffu,
 +/// 23 bits should be enough for anyone.
 +MaxAddressSpace = 0x7fu,

  /// The width of the "fast" qualifier mask.
  FastWidth = 3,
 @@ -265,6 +266,13 @@ public:
  Mask |= mask;
}

 +  bool hasUnaligned() const { return Mask & UMask; }
 +  void setUnaligned(bool flag) {
 +Mask = (Mask & ~UMask) | (flag ? UMask : 0);
 +  }
 +  void removeUnaligned() { Mask &= ~UMask; }
 +  void addUnaligned() { Mask |= UMask; }
 +

r270836 - [X86][F16C] Improved f16c intrinsics checks

2016-05-26 Thread Simon Pilgrim via cfe-commits
Author: rksimon
Date: Thu May 26 05:20:25 2016
New Revision: 270836

URL: http://llvm.org/viewvc/llvm-project?rev=270836&view=rev
Log:
[X86][F16C] Improved f16c intrinsics checks 

Added checks for upper elements being zero'd in scalar conversions

Modified:
cfe/trunk/test/CodeGen/f16c-builtins.c

Modified: cfe/trunk/test/CodeGen/f16c-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/f16c-builtins.c?rev=270836&r1=270835&r2=270836&view=diff
==
--- cfe/trunk/test/CodeGen/f16c-builtins.c (original)
+++ cfe/trunk/test/CodeGen/f16c-builtins.c Thu May 26 05:20:25 2016
@@ -7,36 +7,50 @@
 
 float test_cvtsh_ss(unsigned short a) {
   // CHECK-LABEL: test_cvtsh_ss
-  // CHECK: @llvm.x86.vcvtph2ps.128
+  // CHECK: insertelement <8 x i16> undef, i16 %{{.*}}, i32 0
+  // CHECK: insertelement <8 x i16> %{{.*}}, i16 0, i32 1
+  // CHECK: insertelement <8 x i16> %{{.*}}, i16 0, i32 2
+  // CHECK: insertelement <8 x i16> %{{.*}}, i16 0, i32 3
+  // CHECK: insertelement <8 x i16> %{{.*}}, i16 0, i32 4
+  // CHECK: insertelement <8 x i16> %{{.*}}, i16 0, i32 5
+  // CHECK: insertelement <8 x i16> %{{.*}}, i16 0, i32 6
+  // CHECK: insertelement <8 x i16> %{{.*}}, i16 0, i32 7
+  // CHECK: call <4 x float> @llvm.x86.vcvtph2ps.128(<8 x i16> %{{.*}})
+  // CHECK: extractelement <4 x float> %{{.*}}, i32 0
   return _cvtsh_ss(a);
 }
 
 unsigned short test_cvtss_sh(float a) {
   // CHECK-LABEL: test_cvtss_sh
-  // CHECK: @llvm.x86.vcvtps2ph.128
+  // CHECK: insertelement <4 x float> undef, float %{{.*}}, i32 0
+  // CHECK: insertelement <4 x float> %{{.*}}, float 0.00e+00, i32 1
+  // CHECK: insertelement <4 x float> %{{.*}}, float 0.00e+00, i32 2
+  // CHECK: insertelement <4 x float> %{{.*}}, float 0.00e+00, i32 3
+  // CHECK: call <8 x i16> @llvm.x86.vcvtps2ph.128(<4 x float> %{{.*}}, i32 0)
+  // CHECK: extractelement <8 x i16> %{{.*}}, i32 0
   return _cvtss_sh(a, 0);
 }
 
 __m128 test_mm_cvtph_ps(__m128i a) {
   // CHECK-LABEL: test_mm_cvtph_ps
-  // CHECK: @llvm.x86.vcvtph2ps.128
+  // CHECK: call <4 x float> @llvm.x86.vcvtph2ps.128(<8 x i16> %{{.*}})
   return _mm_cvtph_ps(a);
 }
 
 __m256 test_mm256_cvtph_ps(__m128i a) {
   // CHECK-LABEL: test_mm256_cvtph_ps
-  // CHECK: @llvm.x86.vcvtph2ps.256
+  // CHECK: call <8 x float> @llvm.x86.vcvtph2ps.256(<8 x i16> %{{.*}})
   return _mm256_cvtph_ps(a);
 }
 
 __m128i test_mm_cvtps_ph(__m128 a) {
   // CHECK-LABEL: test_mm_cvtps_ph
-  // CHECK: @llvm.x86.vcvtps2ph.128
+  // CHECK: call <8 x i16> @llvm.x86.vcvtps2ph.128(<4 x float> %{{.*}}, i32 0)
   return _mm_cvtps_ph(a, 0);
 }
 
 __m128i test_mm256_cvtps_ph(__m256 a) {
   // CHECK-LABEL: test_mm256_cvtps_ph
-  // CHECK: @llvm.x86.vcvtps2ph.256
+  // CHECK: call <8 x i16> @llvm.x86.vcvtps2ph.256(<8 x float> %{{.*}}, i32 0)
   return _mm256_cvtps_ph(a, 0);
 }


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


[PATCH] D20672: Don't pass -fms-compatibility-version flag during build

2016-05-26 Thread İsmail Dönmez via cfe-commits
ismail created this revision.
ismail added reviewers: hans, rnk.
ismail added a subscriber: cfe-commits.
ismail set the repository for this revision to rL LLVM.

Since some time clang itself figures out the default for 
ms-compatibility-version and uses it. Trying to figure it out during build is 
redundant and also will not work when the environment variable VSINSTALLDIR is 
not defined (which is not defined if you don't install whole Visual Studio but 
use Visual C++ Build Tools package).

Tested by bootstrapping clang with clang-cl.


Repository:
  rL LLVM

http://reviews.llvm.org/D20672

Files:
  cmake/modules/HandleLLVMOptions.cmake

Index: cmake/modules/HandleLLVMOptions.cmake
===
--- cmake/modules/HandleLLVMOptions.cmake
+++ cmake/modules/HandleLLVMOptions.cmake
@@ -353,19 +353,6 @@
   append("/Zc:rvalueCast" CMAKE_CXX_FLAGS)
 
   if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
-# Find and run MSVC (not clang-cl) and get its version. This will tell
-# clang-cl what version of MSVC to pretend to be so that the STL works.
-execute_process(COMMAND "$ENV{VSINSTALLDIR}/VC/bin/cl.exe"
-  OUTPUT_QUIET
-  ERROR_VARIABLE MSVC_COMPAT_VERSION
-  )
-string(REGEX REPLACE "^.*Compiler Version ([0-9.]+) for .*$" "\\1"
-  MSVC_COMPAT_VERSION "${MSVC_COMPAT_VERSION}")
-append("-fms-compatibility-version=${MSVC_COMPAT_VERSION}"
-  CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
-  endif()
-
-  if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
 # clang-cl and cl by default produce non-deterministic binaries because
 # link.exe /incremental requires a timestamp in the .obj file.  clang-cl
 # has the flag /Brepro to force deterministic binaries. We want to pass 
that


Index: cmake/modules/HandleLLVMOptions.cmake
===
--- cmake/modules/HandleLLVMOptions.cmake
+++ cmake/modules/HandleLLVMOptions.cmake
@@ -353,19 +353,6 @@
   append("/Zc:rvalueCast" CMAKE_CXX_FLAGS)
 
   if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
-# Find and run MSVC (not clang-cl) and get its version. This will tell
-# clang-cl what version of MSVC to pretend to be so that the STL works.
-execute_process(COMMAND "$ENV{VSINSTALLDIR}/VC/bin/cl.exe"
-  OUTPUT_QUIET
-  ERROR_VARIABLE MSVC_COMPAT_VERSION
-  )
-string(REGEX REPLACE "^.*Compiler Version ([0-9.]+) for .*$" "\\1"
-  MSVC_COMPAT_VERSION "${MSVC_COMPAT_VERSION}")
-append("-fms-compatibility-version=${MSVC_COMPAT_VERSION}"
-  CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
-  endif()
-
-  if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
 # clang-cl and cl by default produce non-deterministic binaries because
 # link.exe /incremental requires a timestamp in the .obj file.  clang-cl
 # has the flag /Brepro to force deterministic binaries. We want to pass that
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20423: [Clang][LLVMGold] Passing LLVM arguments to gold plugin

2016-05-26 Thread Bhargav Reddy Godala via cfe-commits
bunty2020 added a comment.

Clang's help shows the following description:
**-mllvm   Additional arguments to forward to LLVM's option 
processing**

If -mllvm  sets some internal option for cc1 then its strange for 
front-end parser using some option which is supposed to be LLVM's option.


http://reviews.llvm.org/D20423



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


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

2016-05-26 Thread jackpoz via cfe-commits
jackpoz added a subscriber: jackpoz.
jackpoz added a comment.

In http://reviews.llvm.org/D18035#440107, @rsmith wrote:

> Please try to appropriately apportion the responsibility here


It has always been clear who created the issue, GCC ABI 11 are there to stay, 
with the result of having an unusable clang since Ubuntu 15.10 (at least in my 
case).
It's responsibility of clang developers to review and accept patches tho, 
please hit the "Merge" button so clang users can build their applications on 
recent distros without having to rely on GCC.

Thank you Dmitry for the effort put into this patch and into the weekly 
friendly pings, your perseverance is admirable.


http://reviews.llvm.org/D18035



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


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

2016-05-26 Thread Thomas Tanner via cfe-commits
ttanner added a comment.

In http://reviews.llvm.org/D18035#440107, @rsmith wrote:

> No, they'll be shipping with a broken copy of their C++ standard library, and 
> will fail to conform to the Linux Standards Base specifications due to 
> deviating from the Itanium C++ ABI. This patch is working around another 
> popular implementation's failure to follow the relevant specification, 
> nothing more. Please try to appropriately apportion the responsibility here; 
> if your distribution opted into a non-standard ABI for their C++ standard 
> library, you should point out to them that they made a mistake.


The new ABI is the de facto standard and we have to live with it, or at least 
support it.
It's too late to convince the major distributions to choose another solution.


http://reviews.llvm.org/D18035



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


r270838 - [OPENMP] Add option '-fopenmp-version=[31|40|45]' allowing choosing

2016-05-26 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Thu May 26 06:10:11 2016
New Revision: 270838

URL: http://llvm.org/viewvc/llvm-project?rev=270838&view=rev
Log:
[OPENMP] Add option '-fopenmp-version=[31|40|45]' allowing choosing
OpenMP version.

If '-fopenmp' option is provided '-fopenmp-version=' allows to control,
which version of OpenMP must be supported. Currently it affects only the
value of _OPENMP define.

Modified:
cfe/trunk/include/clang/Basic/LangOptions.def
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/Frontend/InitPreprocessor.cpp
cfe/trunk/test/OpenMP/driver.c
cfe/trunk/test/OpenMP/predefined_macro.c

Modified: cfe/trunk/include/clang/Basic/LangOptions.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.def?rev=270838&r1=270837&r2=270838&view=diff
==
--- cfe/trunk/include/clang/Basic/LangOptions.def (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.def Thu May 26 06:10:11 2016
@@ -182,7 +182,7 @@ LANGOPT(NativeHalfType, 1, 0, "Nativ
 LANGOPT(NativeHalfArgsAndReturns, 1, 0, "Native half args and returns")
 LANGOPT(HalfArgsAndReturns, 1, 0, "half args and returns")
 LANGOPT(CUDA  , 1, 0, "CUDA")
-LANGOPT(OpenMP, 1, 0, "OpenMP support")
+LANGOPT(OpenMP, 32, 0, "OpenMP support and version of OpenMP (31, 
40 or 45)")
 LANGOPT(OpenMPUseTLS  , 1, 0, "Use TLS for threadprivates or runtime 
calls")
 LANGOPT(OpenMPIsDevice, 1, 0, "Generate code only for OpenMP target 
device")
 

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=270838&r1=270837&r2=270838&view=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Thu May 26 06:10:11 2016
@@ -1004,6 +1004,7 @@ def fobjc_sender_dependent_dispatch : Fl
 def fomit_frame_pointer : Flag<["-"], "fomit-frame-pointer">, Group;
 def fopenmp : Flag<["-"], "fopenmp">, Group, Flags<[CC1Option, 
NoArgumentUnused]>;
 def fno_openmp : Flag<["-"], "fno-openmp">, Group, 
Flags<[NoArgumentUnused]>;
+def fopenmp_version_EQ : Joined<["-"], "fopenmp-version=">, Group, 
Flags<[CC1Option, NoArgumentUnused]>;
 def fopenmp_EQ : Joined<["-"], "fopenmp=">, Group;
 def fopenmp_use_tls : Flag<["-"], "fopenmp-use-tls">, Group, 
Flags<[NoArgumentUnused]>;
 def fnoopenmp_use_tls : Flag<["-"], "fnoopenmp-use-tls">, Group, 
Flags<[CC1Option, NoArgumentUnused]>;

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=270838&r1=270837&r2=270838&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Thu May 26 06:10:11 2016
@@ -4862,7 +4862,8 @@ void Clang::ConstructJob(Compilation &C,
 
   // Forward flags for OpenMP
   if (Args.hasFlag(options::OPT_fopenmp, options::OPT_fopenmp_EQ,
-   options::OPT_fno_openmp, false))
+   options::OPT_fno_openmp, false)) {
+Args.AddAllArgs(CmdArgs, options::OPT_fopenmp_version_EQ);
 switch (getOpenMPRuntime(getToolChain(), Args)) {
 case OMPRT_OMP:
 case OMPRT_IOMP5:
@@ -4885,6 +4886,7 @@ void Clang::ConstructJob(Compilation &C,
   // semantic analysis, etc.
   break;
 }
+  }
 
   const SanitizerArgs &Sanitize = getToolChain().getSanitizerArgs();
   Sanitize.addArgs(getToolChain(), Args, CmdArgs, InputType);

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=270838&r1=270837&r2=270838&view=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Thu May 26 06:10:11 2016
@@ -1960,18 +1960,23 @@ static void ParseLangArgs(LangOptions &O
   Opts.OpenMPIsDevice =
   Opts.OpenMP && Args.hasArg(options::OPT_fopenmp_is_device);
 
-  // Provide diagnostic when a given target is not expected to be an OpenMP
-  // device or host.
-  if (Opts.OpenMP && !Opts.OpenMPIsDevice) {
-switch (T.getArch()) {
-default:
-  break;
-// Add unsupported host targets here:
-case llvm::Triple::nvptx:
-case llvm::Triple::nvptx64:
-  Diags.Report(clang::diag::err_drv_omp_host_target_not_supported)
-  << TargetOpts.Triple;
-  break;
+  if (Opts.OpenMP) {
+if (int Version = getLastArgIntValue(Args, OPT_fopenmp_version_EQ,
+ Opts.OpenMP, Diags))
+  Opts.OpenMP = Version;
+// Provide diagnostic when a given target is not expected to be an OpenMP
+// device 

[clang-tools-extra] r270841 - clang-tools-extra/test/clang-tidy/cppcoreguidelines-pro-type-vararg.cpp: Tweak for r270775.

2016-05-26 Thread NAKAMURA Takumi via cfe-commits
Author: chapuni
Date: Thu May 26 06:20:54 2016
New Revision: 270841

URL: http://llvm.org/viewvc/llvm-project?rev=270841&view=rev
Log:
clang-tools-extra/test/clang-tidy/cppcoreguidelines-pro-type-vararg.cpp: Tweak 
for r270775.

Modified:

clang-tools-extra/trunk/test/clang-tidy/cppcoreguidelines-pro-type-vararg.cpp

Modified: 
clang-tools-extra/trunk/test/clang-tidy/cppcoreguidelines-pro-type-vararg.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/cppcoreguidelines-pro-type-vararg.cpp?rev=270841&r1=270840&r2=270841&view=diff
==
--- 
clang-tools-extra/trunk/test/clang-tidy/cppcoreguidelines-pro-type-vararg.cpp 
(original)
+++ 
clang-tools-extra/trunk/test/clang-tidy/cppcoreguidelines-pro-type-vararg.cpp 
Thu May 26 06:20:54 2016
@@ -15,7 +15,7 @@ void check() {
   f_vararg(1, 7, 9);
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not call c-style vararg 
functions [cppcoreguidelines-pro-type-vararg]
   c.g_vararg("foo");
-  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not call c-style vararg 
functions
+  // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: do not call c-style vararg 
functions
 
   f(3); // OK
   c.g("foo"); // OK


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


r270842 - [driver][mips] Specify stdlib used in the tests explicitly

2016-05-26 Thread Simon Atanasyan via cfe-commits
Author: atanasyan
Date: Thu May 26 06:32:19 2016
New Revision: 270842

URL: http://llvm.org/viewvc/llvm-project?rev=270842&view=rev
Log:
[driver][mips] Specify stdlib used in the tests explicitly

That allows to pass the tests even if default stdlib is not libstdc++.

Modified:
cfe/trunk/test/Driver/mips-img-v2.cpp
cfe/trunk/test/Driver/mips-mti.cpp

Modified: cfe/trunk/test/Driver/mips-img-v2.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mips-img-v2.cpp?rev=270842&r1=270841&r2=270842&view=diff
==
--- cfe/trunk/test/Driver/mips-img-v2.cpp (original)
+++ cfe/trunk/test/Driver/mips-img-v2.cpp Thu May 26 06:32:19 2016
@@ -4,6 +4,7 @@
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
 // RUN:--target=mips-img-linux-gnu \
 // RUN:--gcc-toolchain=%S/Inputs/mips_img_v2_tree \
+// RUN:-stdlib=libstdc++ \
 // RUN:-EB -mips32r6 -mhard-float -mabi=32 \
 // RUN:   | FileCheck --check-prefix=EB-HARD-O32 %s
 // EB-HARD-O32: "-internal-isystem"
@@ -31,6 +32,7 @@
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
 // RUN:--target=mips-img-linux-gnu \
 // RUN:--gcc-toolchain=%S/Inputs/mips_img_v2_tree \
+// RUN:-stdlib=libstdc++ \
 // RUN:-EB -mips64r6 -mhard-float -mabi=n32 \
 // RUN:   | FileCheck --check-prefix=EB-HARD-N32 %s
 // EB-HARD-N32: "-internal-isystem"
@@ -58,6 +60,7 @@
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
 // RUN:--target=mips64-img-linux-gnu \
 // RUN:--gcc-toolchain=%S/Inputs/mips_img_v2_tree \
+// RUN:-stdlib=libstdc++ \
 // RUN:-EB -mips64r6 -mhard-float -mabi=64 \
 // RUN:   | FileCheck --check-prefix=EB-HARD-N64 %s
 // EB-HARD-N64: "-internal-isystem"
@@ -85,6 +88,7 @@
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
 // RUN:--target=mips-img-linux-gnu \
 // RUN:--gcc-toolchain=%S/Inputs/mips_img_v2_tree \
+// RUN:-stdlib=libstdc++ \
 // RUN:-EL -mips32r6 -mhard-float -mabi=32 \
 // RUN:   | FileCheck --check-prefix=EL-HARD-O32 %s
 // EL-HARD-O32: "-internal-isystem"
@@ -112,6 +116,7 @@
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
 // RUN:--target=mips-img-linux-gnu \
 // RUN:--gcc-toolchain=%S/Inputs/mips_img_v2_tree \
+// RUN:-stdlib=libstdc++ \
 // RUN:-EL -mips64r6 -mhard-float -mabi=n32 \
 // RUN:   | FileCheck --check-prefix=EL-HARD-N32 %s
 // EL-HARD-N32: "-internal-isystem"
@@ -139,6 +144,7 @@
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
 // RUN:--target=mips64-img-linux-gnu \
 // RUN:--gcc-toolchain=%S/Inputs/mips_img_v2_tree \
+// RUN:-stdlib=libstdc++ \
 // RUN:-EL -mips64r6 -mhard-float -mabi=64 \
 // RUN:   | FileCheck --check-prefix=EL-HARD-N64 %s
 // EL-HARD-N64: "-internal-isystem"
@@ -166,6 +172,7 @@
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
 // RUN:--target=mips-img-linux-gnu \
 // RUN:--gcc-toolchain=%S/Inputs/mips_img_v2_tree \
+// RUN:-stdlib=libstdc++ \
 // RUN:-EB -mips32r6 -msoft-float \
 // RUN:   | FileCheck --check-prefix=EB-SOFT %s
 // EB-SOFT: "-internal-isystem"
@@ -193,6 +200,7 @@
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
 // RUN:--target=mips-img-linux-gnu \
 // RUN:--gcc-toolchain=%S/Inputs/mips_img_v2_tree \
+// RUN:-stdlib=libstdc++ \
 // RUN:-EL -mips32r6 -msoft-float \
 // RUN:   | FileCheck --check-prefix=EL-SOFT %s
 // EL-SOFT: "-internal-isystem"
@@ -220,6 +228,7 @@
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
 // RUN:--target=mips-img-linux-gnu \
 // RUN:--gcc-toolchain=%S/Inputs/mips_img_v2_tree \
+// RUN:-stdlib=libstdc++ \
 // RUN:-EB -mips32r6 -mhard-float -mmicromips \
 // RUN:   | FileCheck --check-prefix=EB-HARD-MICRO %s
 // EB-HARD-MICRO: "-internal-isystem"
@@ -247,6 +256,7 @@
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
 // RUN:--target=mips-img-linux-gnu \
 // RUN:--gcc-toolchain=%S/Inputs/mips_img_v2_tree \
+// RUN:-stdlib=libstdc++ \
 // RUN:-EB -mips32r6 -msoft-float -mmicromips \
 // RUN:   | FileCheck --check-prefix=EB-SOFT-MICRO %s
 // EB-SOFT-MICRO: "-internal-isystem"
@@ -274,6 +284,7 @@
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
 // RUN:--target=mips-img-linux-gnu \
 // RUN:--gcc-toolchain=%S/Inputs/mips_img_v2_tree \
+// RUN:-stdlib=libstdc++ \
 // RUN:-EL -mips32r6 -mhard-float -mmicromips \
 // RUN:   | FileCheck --check-prefix=EL-HARD-MICRO %s
 // EL-HARD-MICRO: "-internal-isystem"
@@ -301,6 +312,7 @@
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
 // RUN:--target=mips-img-linux-gnu \
 // RUN:--gcc-toolchain=%S/Inputs/mips_img_v2_tree \
+// RUN:-stdlib=libstdc++ \
 //

Re: [PATCH] D19909: [Attr] Add support for the `ms_hook_prologue` attribute.

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

LGTM (when Sanjoy's patch goes in), with two minor nits.

Can you also add a test that the attribute fails on one of the target 
architectures Windows does not support?



Comment at: include/clang/Basic/AttrDocs.td:506
@@ +505,3 @@
+
+.. _`/HOTPATCH`: https://msdn.microsoft.com/en-us/library/ms173507.aspx
+  }];

Should document that we disallow it in conjunction with naked, always_inline, 
and __forceinline.


http://reviews.llvm.org/D19909



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


Re: [PATCH] D20366: [ASTMatcher] Make dump_ast_matchers.py executable.

2016-05-26 Thread Aaron Ballman via cfe-commits
aaron.ballman added a comment.

In http://reviews.llvm.org/D20366#433204, @hokein wrote:

> In http://reviews.llvm.org/D20366#433123, @aaron.ballman wrote:
>
> > What's the harm in leaving the props at 0644?
>
>
> Just inconvenient . And I see the `dump_format_style.py` in the same 
> directory is executable.


I guess I would recommend making both python scripts executable with 
svn:executable is the correct way to go, instead of setting the file mode 
directly.


http://reviews.llvm.org/D20366



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


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

2016-05-26 Thread Aaron Ballman via cfe-commits
aaron.ballman added a subscriber: aaron.ballman.
aaron.ballman added a comment.

Thank you for working on this diagnostic! A few questions and comments below.



Comment at: lib/Sema/SemaExpr.cpp:10518
@@ +10517,3 @@
+  // Taking the address of a data member/field of a packed
+  // struct may be a problem if the pointer value is dereferenced
+  MemberExpr *ME = dyn_cast(op);

Missing a full stop at the end of the sentence.


Comment at: lib/Sema/SemaExpr.cpp:10519
@@ +10518,3 @@
+  // struct may be a problem if the pointer value is dereferenced
+  MemberExpr *ME = dyn_cast(op);
+  while (ME && isa(ME->getMemberDecl())) {

Can use `const auto *` here instead of repeating the type name.


Comment at: lib/Sema/SemaExpr.cpp:10527
@@ +10526,3 @@
+ME->getMemberDecl()->hasAttr()) {
+  Diag(OpLoc, diag::warn_taking_address_of_packed_member)
+  << ME->getMemberDecl() << RD;

I wonder if we should diagnose only when the resulting pointer is actually 
misaligned. For instance, the following code should be just fine:
```
struct __attribute__((packed)) S {
  int i;
};

void f(S s) {
  int *ip = &s.i; // Why should this warn?
}
```
Have you run this patch over any large code bases to see how high the 
false-positive rate is? How do you envision users silencing this diagnostic if 
they have a false-positive? Something like `&(s.x)` (since I you're not 
ignoring paren imp casts)?


Comment at: test/Sema/address-packed.c:1
@@ +1,2 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -xc++ -fsyntax-only -verify %s

You should run clang-format over this file (or indeed, the entire patch).


Comment at: test/Sema/address-packed.c:2
@@ +1,3 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -xc++ -fsyntax-only -verify %s
+extern void f1(int *);

I would split this test case into two, one in Sema for C and one in SemaCXX for 
C++.


http://reviews.llvm.org/D20561



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


Re: [PATCH] D19274: Compilation for Intel MCU (Part 2/3)

2016-05-26 Thread Andrey Turetskiy via cfe-commits
aturetsk added inline comments.


Comment at: lib/Driver/Tools.cpp:3657
@@ +3656,3 @@
+  if (IsIAMCU && types::isCXX(Input.getType()))
+D.Diag(diag::err_drv_cxx_not_supported) << 
getToolChain().getTriple().str();
+

bruno wrote:
> Taking a look at this again I don't think there's a real need for a new 
> diagnostic here; instead of adding diag::err_drv_cxx_not_supported, you can 
> do something similar to:
> 
> D.Diag(diag::err_drv_clang_unsupported) << "C++ is not supported with -miamcu"
> 
> Otherwise, LGTM!
The best thing I could come up with is this:
```
D.Diag(diag::err_drv_clang_unsupported) << "C++ for IAMCU";
```
This code makes the error message look like this:
```
error: the clang compiler does not support 'C++ for IAMCU'
```
As you can see the message is a bit crooked. Do you thinks it's better to keep 
it this way?


http://reviews.llvm.org/D19274



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


[PATCH] D20675: Compilation for Intel MCU (Part 3/3)

2016-05-26 Thread Andrey Turetskiy via cfe-commits
aturetsk created this revision.
aturetsk added reviewers: rsmith, bruno.
aturetsk added subscribers: cfe-commits, zinovy.nis, DavidKreitzer.
Herald added subscribers: srhines, danalbert, tberghammer.

This is the last patch required to support compilation for Intel MCU target 
(e.g. Intel(R) Quark(TM) micro controller D 2000).

When IAMCU triple is used:
* Use IAMCU linker output format
* Link with IAMCU crt objects
* Link with IAMCU libraries

http://reviews.llvm.org/D20675

Files:
  lib/Driver/Tools.cpp
  test/Driver/miamcu-opt.c

Index: test/Driver/miamcu-opt.c
===
--- test/Driver/miamcu-opt.c
+++ test/Driver/miamcu-opt.c
@@ -18,4 +18,12 @@
 // CHECK: "-mstack-alignment=4"
 
 // CHECK: bin/ld
+// CHECK: "-m" "elf_iamcu"
 // CHECK: "-static"
+// CHECK-NOT: crt1
+// CHECK-NOT: crti
+// CHECK-NOT: ctrbegin
+// CHECK: crt0
+// CHECK: "--start-group" "-lgcc" "-lc" "-lgloss" "--end-group" "--as-needed" "-lsoftfp" "--no-as-needed"
+// CHECK-NOT: crtend
+// CHECK-NOT: ctrn
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -9011,6 +9011,7 @@
   ArgStringList &CmdArgs, const ArgList &Args) {
   bool isAndroid = Triple.isAndroid();
   bool isCygMing = Triple.isOSCygMing();
+  bool IsIAMCU = Triple.isOSIAMCU();
   bool StaticLibgcc = Args.hasArg(options::OPT_static_libgcc) ||
   Args.hasArg(options::OPT_static);
   if (!D.CCCIsCXX())
@@ -9027,7 +9028,7 @@
   CmdArgs.push_back("--no-as-needed");
   }
 
-  if (StaticLibgcc && !isAndroid)
+  if (StaticLibgcc && !isAndroid && !IsIAMCU)
 CmdArgs.push_back("-lgcc_eh");
   else if (!Args.hasArg(options::OPT_shared) && D.CCCIsCXX())
 CmdArgs.push_back("-lgcc");
@@ -9075,6 +9076,8 @@
 static const char *getLDMOption(const llvm::Triple &T, const ArgList &Args) {
   switch (T.getArch()) {
   case llvm::Triple::x86:
+if (T.isOSIAMCU())
+  return "elf_iamcu";
 return "elf_i386";
   case llvm::Triple::aarch64:
 return "aarch64linux";
@@ -9134,6 +9137,7 @@
 
   const llvm::Triple::ArchType Arch = ToolChain.getArch();
   const bool isAndroid = ToolChain.getTriple().isAndroid();
+  const bool IsIAMCU = ToolChain.getTriple().isOSIAMCU();
   const bool IsPIE =
   !Args.hasArg(options::OPT_shared) && !Args.hasArg(options::OPT_static) &&
   (Args.hasArg(options::OPT_pie) || ToolChain.isPIEDefault());
@@ -9210,7 +9214,7 @@
   CmdArgs.push_back(Output.getFilename());
 
   if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
-if (!isAndroid) {
+if (!isAndroid && !IsIAMCU) {
   const char *crt1 = nullptr;
   if (!Args.hasArg(options::OPT_shared)) {
 if (Args.hasArg(options::OPT_pg))
@@ -9226,18 +9230,22 @@
   CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crti.o")));
 }
 
-const char *crtbegin;
-if (Args.hasArg(options::OPT_static))
-  crtbegin = isAndroid ? "crtbegin_static.o" : "crtbeginT.o";
-else if (Args.hasArg(options::OPT_shared))
-  crtbegin = isAndroid ? "crtbegin_so.o" : "crtbeginS.o";
-else if (IsPIE)
-  crtbegin = isAndroid ? "crtbegin_dynamic.o" : "crtbeginS.o";
-else
-  crtbegin = isAndroid ? "crtbegin_dynamic.o" : "crtbegin.o";
+if (IsIAMCU)
+  CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crt0.o")));
+else {
+  const char *crtbegin;
+  if (Args.hasArg(options::OPT_static))
+crtbegin = isAndroid ? "crtbegin_static.o" : "crtbeginT.o";
+  else if (Args.hasArg(options::OPT_shared))
+crtbegin = isAndroid ? "crtbegin_so.o" : "crtbeginS.o";
+  else if (IsPIE)
+crtbegin = isAndroid ? "crtbegin_dynamic.o" : "crtbeginS.o";
+  else
+crtbegin = isAndroid ? "crtbegin_dynamic.o" : "crtbegin.o";
 
-if (HasCRTBeginEndFiles)
-  CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(crtbegin)));
+  if (HasCRTBeginEndFiles)
+CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(crtbegin)));
+}
 
 // Add crtfastmath.o if available and fast math is enabled.
 ToolChain.AddFastMathRuntimeIfAvailable(Args, CmdArgs);
@@ -9321,13 +9329,24 @@
 
   CmdArgs.push_back("-lc");
 
+  // Add IAMCU specific libs, if needed.
+  if (IsIAMCU)
+CmdArgs.push_back("-lgloss");
+
   if (Args.hasArg(options::OPT_static))
 CmdArgs.push_back("--end-group");
   else
 AddRunTimeLibs(ToolChain, D, CmdArgs, Args);
+
+  // Add IAMCU specific libs (outside the group), if needed.
+  if (IsIAMCU) {
+CmdArgs.push_back("--as-needed");
+CmdArgs.push_back("-lsoftfp");
+CmdArgs.push_back("--no-as-needed");
+  }
 }
 
-if (!Args.hasArg(options::OPT_nostartfiles)) {
+if (!Args.hasArg(options::OPT_nostartfiles) && !IsIAMCU) {
   const char *crtend;
   if (Args.hasArg(options::OPT_shared))
 

Re: r270373 - [driver][mips] Support new versions of MIPS CodeScape toolchains

2016-05-26 Thread Simon Atanasyan via cfe-commits
I hope r270842 fixes the problem.

Thanks a lot for your help.

On Thu, May 26, 2016 at 11:28 AM, Ismail Donmez  wrote:
> Indeed the problematic option is -DCLANG_DEFAULT_CXX_STDLIB=libc++ ,
> thanks Jonas!
>
> On Thu, May 26, 2016 at 11:19 AM, Hahnfeld, Jonas
>  wrote:
>> Hi,
>>
>> Have you also set CLANG_DEFAULT_CXX_STDLIB? Then you may need to add an
>> '-stdlib=platform' to the test... (see r260662 and r263434)
>>
>> Cheers,
>> Jonas
>>
>>> -Original Message-
>>> From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf
>>> Of Ismail Donmez via cfe-commits
>>> Sent: Thursday, May 26, 2016 10:03 AM
>>> To: Simon Atanasyan
>>> Cc: cfe-commits
>>> Subject: Re: r270373 - [driver][mips] Support new versions of MIPS
>>> CodeScape toolchains
>>>
>>> Hi,
>>>
>>> I think this is because I enable libc++ by default with -
>>> DLLVM_ENABLE_LIBCXX=ON , so this tests need an explicit -stdlib=libstdc++

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


r270845 - Fix crash while parsing variable template with variadic template arguments

2016-05-26 Thread Olivier Goffart via cfe-commits
Author: ogoffart
Date: Thu May 26 07:55:34 2016
New Revision: 270845

URL: http://llvm.org/viewvc/llvm-project?rev=270845&view=rev
Log:
Fix crash while parsing variable template with variadic template arguments

It is only a crash if the compiler optimize for this!=nullptr because
LocalInstantiationScope::getPartiallySubstitutedPack checks if 'this' is null
(This is crashing when clang is compiled with GCC6)

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

Modified:
cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp
cfe/trunk/test/SemaCXX/cxx1y-variable-templates_top_level.cpp

Modified: cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp?rev=270845&r1=270844&r2=270845&view=diff
==
--- cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp Thu May 26 07:55:34 2016
@@ -604,7 +604,7 @@ bool Sema::CheckParameterPacksForExpansi
 //   Template argument deduction can extend the sequence of template 
 //   arguments corresponding to a template parameter pack, even when the
 //   sequence contains explicitly specified template arguments.
-if (!IsFunctionParameterPack) {
+if (!IsFunctionParameterPack && CurrentInstantiationScope) {
   if (NamedDecl *PartialPack 
 = 
CurrentInstantiationScope->getPartiallySubstitutedPack()){
 unsigned PartialDepth, PartialIndex;

Modified: cfe/trunk/test/SemaCXX/cxx1y-variable-templates_top_level.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx1y-variable-templates_top_level.cpp?rev=270845&r1=270844&r2=270845&view=diff
==
--- cfe/trunk/test/SemaCXX/cxx1y-variable-templates_top_level.cpp (original)
+++ cfe/trunk/test/SemaCXX/cxx1y-variable-templates_top_level.cpp Thu May 26 
07:55:34 2016
@@ -458,3 +458,9 @@ namespace PR19169 {
   template<> int g; // expected-error {{no variable template matches 
specialization; did you mean to use 'g' as function template instead?}}
 }
 
+#ifndef PRECXX11
+template  struct Variadic_t { };
+template  Variadic_t Variadic;
+auto variadic1 = Variadic<>;
+auto variadic2 = Variadic;
+#endif


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


Re: [PATCH] D20511: Fix crash while parsing variable template with variadic template arguments

2016-05-26 Thread Olivier Goffart via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL270845: Fix crash while parsing variable template with 
variadic template arguments (authored by ogoffart).

Changed prior to commit:
  http://reviews.llvm.org/D20511?vs=58043&id=58595#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20511

Files:
  cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp
  cfe/trunk/test/SemaCXX/cxx1y-variable-templates_top_level.cpp

Index: cfe/trunk/test/SemaCXX/cxx1y-variable-templates_top_level.cpp
===
--- cfe/trunk/test/SemaCXX/cxx1y-variable-templates_top_level.cpp
+++ cfe/trunk/test/SemaCXX/cxx1y-variable-templates_top_level.cpp
@@ -458,3 +458,9 @@
   template<> int g; // expected-error {{no variable template matches 
specialization; did you mean to use 'g' as function template instead?}}
 }
 
+#ifndef PRECXX11
+template  struct Variadic_t { };
+template  Variadic_t Variadic;
+auto variadic1 = Variadic<>;
+auto variadic2 = Variadic;
+#endif
Index: cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp
===
--- cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp
+++ cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp
@@ -604,7 +604,7 @@
 //   Template argument deduction can extend the sequence of template 
 //   arguments corresponding to a template parameter pack, even when the
 //   sequence contains explicitly specified template arguments.
-if (!IsFunctionParameterPack) {
+if (!IsFunctionParameterPack && CurrentInstantiationScope) {
   if (NamedDecl *PartialPack 
 = 
CurrentInstantiationScope->getPartiallySubstitutedPack()){
 unsigned PartialDepth, PartialIndex;


Index: cfe/trunk/test/SemaCXX/cxx1y-variable-templates_top_level.cpp
===
--- cfe/trunk/test/SemaCXX/cxx1y-variable-templates_top_level.cpp
+++ cfe/trunk/test/SemaCXX/cxx1y-variable-templates_top_level.cpp
@@ -458,3 +458,9 @@
   template<> int g; // expected-error {{no variable template matches specialization; did you mean to use 'g' as function template instead?}}
 }
 
+#ifndef PRECXX11
+template  struct Variadic_t { };
+template  Variadic_t Variadic;
+auto variadic1 = Variadic<>;
+auto variadic2 = Variadic;
+#endif
Index: cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp
===
--- cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp
+++ cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp
@@ -604,7 +604,7 @@
 //   Template argument deduction can extend the sequence of template 
 //   arguments corresponding to a template parameter pack, even when the
 //   sequence contains explicitly specified template arguments.
-if (!IsFunctionParameterPack) {
+if (!IsFunctionParameterPack && CurrentInstantiationScope) {
   if (NamedDecl *PartialPack 
 = CurrentInstantiationScope->getPartiallySubstitutedPack()){
 unsigned PartialDepth, PartialIndex;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D20677: Make it possible to build a -fno-exceptions libc++abi variant.

2016-05-26 Thread Asiri Rathnayake via cfe-commits
rmaprath created this revision.
rmaprath added reviewers: bcraig, jroelofs, EricWF.
rmaprath added a subscriber: cfe-commits.

Support for building a -fno-exceptions libc++ variant was reinstated recently. 
However, some of the standard library functions like `std::terminate()` are 
currently spread across lib++ and libc++abi, making the -fno-exceptions libc++ 
variant useless when those functions are used (as they pull in all the 
exceptions machinery that we are trying to get rid of in the final image).

This patch makes it possilbe to also build libc++abi with -fno-exceptions so 
that functions like `std::terminate()` can be used in a no-exceptions 
environment.

Most of the sources are already correctly setup to support a -fno-exceptions 
build, I just filled in the missing bits.

If there are no objections, I will get this committed over the weekend.

http://reviews.llvm.org/D20677

Files:
  CMakeLists.txt
  src/cxa_aux_runtime.cpp
  src/cxa_handlers.cpp
  src/cxa_new_delete.cpp
  src/cxa_personality.cpp

Index: src/cxa_personality.cpp
===
--- src/cxa_personality.cpp
+++ src/cxa_personality.cpp
@@ -1201,9 +1201,12 @@
 t_handler = std::get_terminate();
 u_handler = std::get_unexpected();
 }
+#ifndef _LIBCXXABI_NO_EXCEPTIONS
 try
 {
+#endif
 std::__unexpected(u_handler);
+#ifndef _LIBCXXABI_NO_EXCEPTIONS
 }
 catch (...)
 {
@@ -1292,6 +1295,7 @@
 }
 }
 }
+#endif
 std::__terminate(t_handler);
 }
 
Index: src/cxa_new_delete.cpp
===
--- src/cxa_new_delete.cpp
+++ src/cxa_new_delete.cpp
@@ -47,7 +47,11 @@
 if (nh)
 nh();
 else
+#ifndef _LIBCXXABI_NO_EXCEPTIONS
 throw std::bad_alloc();
+#else
+std::terminate();
+#endif
 }
 return p;
 }
@@ -74,13 +78,17 @@
 #endif
 {
 void* p = 0;
+#ifndef _LIBCXXABI_NO_EXCEPTIONS
 try
 {
+#endif
 p = ::operator new(size);
+#ifndef _LIBCXXABI_NO_EXCEPTIONS
 }
 catch (...)
 {
 }
+#endif
 return p;
 }
 
@@ -115,13 +123,17 @@
 #endif
 {
 void* p = 0;
+#ifndef _LIBCXXABI_NO_EXCEPTIONS
 try
 {
+#endif
 p = ::operator new[](size);
+#ifndef _LIBCXXABI_NO_EXCEPTIONS
 }
 catch (...)
 {
 }
+#endif
 return p;
 }
 
Index: src/cxa_handlers.cpp
===
--- src/cxa_handlers.cpp
+++ src/cxa_handlers.cpp
@@ -61,21 +61,21 @@
 void
 __terminate(terminate_handler func) _NOEXCEPT
 {
-#if __has_feature(cxx_exceptions)
+#ifndef _LIBCXXABI_NO_EXCEPTIONS
 try
 {
-#endif  // __has_feature(cxx_exceptions)
+#endif  // _LIBCXXABI_NO_EXCEPTIONS
 func();
 // handler should not return
 abort_message("terminate_handler unexpectedly returned");
-#if __has_feature(cxx_exceptions)
+#ifndef _LIBCXXABI_NO_EXCEPTIONS
 }
 catch (...)
 {
 // handler should not throw exception
 abort_message("terminate_handler unexpectedly threw an exception");
 }
-#endif  // #if __has_feature(cxx_exceptions)
+#endif  // _LIBCXXABI_NO_EXCEPTIONS
 }
 
 __attribute__((noreturn))
Index: src/cxa_aux_runtime.cpp
===
--- src/cxa_aux_runtime.cpp
+++ src/cxa_aux_runtime.cpp
@@ -17,16 +17,28 @@
 namespace __cxxabiv1 {
 extern "C" {
 _LIBCXXABI_FUNC_VIS LIBCXXABI_NORETURN void __cxa_bad_cast(void) {
+#ifndef _LIBCXXABI_NO_EXCEPTIONS
   throw std::bad_cast();
+#else
+  std::terminate();
+#endif
 }
 
 _LIBCXXABI_FUNC_VIS LIBCXXABI_NORETURN void __cxa_bad_typeid(void) {
+#ifndef _LIBCXXABI_NO_EXCEPTIONS
   throw std::bad_typeid();
+#else
+  std::terminate();
+#endif
 }
 
 _LIBCXXABI_FUNC_VIS LIBCXXABI_NORETURN void
 __cxa_throw_bad_array_new_length(void) {
+#ifndef _LIBCXXABI_NO_EXCEPTIONS
   throw std::bad_array_new_length();
+#else
+  std::terminate();
+#endif
 }
 } // extern "C"
 } // abi
Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -108,6 +108,7 @@
 #===
 
 # Define options.
+option(LIBCXXABI_ENABLE_EXCEPTIONS "Use exceptions." ON)
 option(LIBCXXABI_ENABLE_ASSERTIONS "Enable assertions independent of build mode." ON)
 option(LIBCXXABI_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
 option(LIBCXXABI_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
@@ -241,13 +242,20 @@
 endif()
 
 # Get feature flags.
-# Exceptions
-# Catches C++ exceptions only and tells the compiler to assume that extern C
-# functions never throw a C++ exception.
 append_if(LIBCXXABI_CXX_FLAGS LIBCXXABI_HAS_FSTRICT_ALIASING_FLAG -fstrict-aliasing)
-append_if(LIBCXXABI_CXX_FLAGS LIBCXXABI_HAS_EHSC_FLAG -EHsc)
 
-append_if(LIBCXXABI_C_FLAGS LIBCXXABI_HAS_FUNWIND_TABLES -funwind

Re: r270775 - [CGDebugInfo] Modify the preferred expression location for member calls.

2016-05-26 Thread NAKAMURA Takumi via cfe-commits
Could you take a look of r270841 in clang-tools-extra?

On Thu, May 26, 2016 at 7:14 AM Hal Finkel via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: hfinkel
> Date: Wed May 25 17:08:27 2016
> New Revision: 270775
>
> URL: http://llvm.org/viewvc/llvm-project?rev=270775&view=rev
> Log:
> [CGDebugInfo] Modify the preferred expression location for member calls.
>
> If the callee has a valid location (not all do), then use that. Otherwise,
> fall
> back to the starting location. This makes sure that the debug info for
> calls
> points to the call (not the start of the expression providing the object on
> which the member function is being called).
>
> For example, given this:
>
>   f->foo()->bar();
>
> we don't want both calls to point to the 'f', but rather to the 'foo()' and
> the 'bar()'.
>
> Fixes PR27567.
>
> Differential Revision: http://reviews.llvm.org/D19708
>
> Added:
> cfe/trunk/test/CodeGenCXX/debug-info-member-call.cpp
> Modified:
> cfe/trunk/include/clang/AST/ExprCXX.h
>
> Modified: cfe/trunk/include/clang/AST/ExprCXX.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprCXX.h?rev=270775&r1=270774&r2=270775&view=diff
>
> ==
> --- cfe/trunk/include/clang/AST/ExprCXX.h (original)
> +++ cfe/trunk/include/clang/AST/ExprCXX.h Wed May 25 17:08:27 2016
> @@ -143,6 +143,14 @@ public:
>/// FIXME: Returns 0 for member pointer call exprs.
>CXXRecordDecl *getRecordDecl() const;
>
> +  SourceLocation getExprLoc() const LLVM_READONLY {
> +SourceLocation CLoc = getCallee()->getExprLoc();
> +if (CLoc.isValid())
> +  return CLoc;
> +
> +return getLocStart();
> +  }
> +
>static bool classof(const Stmt *T) {
>  return T->getStmtClass() == CXXMemberCallExprClass;
>}
>
> Added: cfe/trunk/test/CodeGenCXX/debug-info-member-call.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-member-call.cpp?rev=270775&view=auto
>
> ==
> --- cfe/trunk/test/CodeGenCXX/debug-info-member-call.cpp (added)
> +++ cfe/trunk/test/CodeGenCXX/debug-info-member-call.cpp Wed May 25
> 17:08:27 2016
> @@ -0,0 +1,24 @@
> +// RUN: %clang_cc1 -triple x86_64-unknown_unknown -emit-llvm
> -debug-info-kind=standalone -dwarf-column-info %s -o - | FileCheck %s
> +void ext();
> +
> +struct Bar {
> +  void bar() { ext(); }
> +};
> +
> +struct Foo {
> +  Bar *b;
> +
> +  Bar *foo() { return b; }
> +};
> +
> +void test(Foo *f) {
> +  f->foo()->bar();
> +}
> +
> +// CHECK-LABEL: @_Z4testP3Foo
> +// CHECK: call {{.*}} @_ZN3Foo3fooEv{{.*}}, !dbg ![[CALL1LOC:.*]]
> +// CHECK: call void @_ZN3Bar3barEv{{.*}}, !dbg ![[CALL2LOC:.*]]
> +
> +// CHECK: ![[CALL1LOC]] = !DILocation(line: [[LINE:[0-9]+]], column: 6,
> +// CHECK: ![[CALL2LOC]] = !DILocation(line: [[LINE]], column: 13,
> +
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2016-05-26 Thread Dmitry Polukhin via cfe-commits
On Thu, May 26, 2016 at 12:41 AM, David Majnemer 
wrote:

> In http://reviews.llvm.org/D18035#434095, @DmitryPolukhin wrote:
>
> > One more friendly ping.. :(
>
> I think the best way to make progress on this is to refactor this patch
> along the lines @rsmith suggested back on May 3.
>

To be honest I still don't understand what is the key difference between
these two approaches. Both assume that compiler mangles something twice:
one for collecting implicit abi_tags without outputting name to real stream
and once more time mangling name for real with implicit tags collected on
previous stage. I tested my patch on Richard's example and explained why it
works as it should be.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D20678: [mips] Fold MipsTargetInfoBase subclasses into MipsTargetInfoBase and rename to MipsTargetInfo. NFC

2016-05-26 Thread Daniel Sanders via cfe-commits
dsanders created this revision.
dsanders added subscribers: cfe-commits, atanasyan.
Herald added subscribers: dschuff, jfb.

This unifies mips/mipsel and mips64/mips64el into a single class so that we can
later support O32 on mips64/mips64el and N32/N64 on mips/mipsel (when an
appropriate CPU selected).

http://reviews.llvm.org/D20678

Files:
  lib/Basic/Targets.cpp

Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -6938,8 +6938,29 @@
   }
 };
 
-class MipsTargetInfoBase : public TargetInfo {
-  virtual void setDataLayout() = 0;
+class MipsTargetInfo : public TargetInfo {
+  void setDataLayout() {
+if (BigEndian) {
+  if (ABI == "o32" || ABI == "eabi")
+resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64");
+  else if (ABI == "n32")
+resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128");
+  else if (ABI == "n64")
+resetDataLayout("E-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128");
+  else
+llvm_unreachable("Invalid ABI");
+} else {
+  if (ABI == "o32" || ABI == "eabi")
+resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64");
+  else if (ABI == "n32")
+resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128");
+  else if (ABI == "n64")
+resetDataLayout("e-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128");
+  else
+llvm_unreachable("Invalid ABI");
+}
+  }
+
 
   static const Builtin::Info BuiltinInfo[];
   std::string CPU;
@@ -6960,12 +6981,40 @@
   std::string ABI;
 
 public:
-  MipsTargetInfoBase(const llvm::Triple &Triple, const TargetOptions &,
- const std::string &ABIStr, const std::string &CPUStr)
-  : TargetInfo(Triple), CPU(CPUStr), IsMips16(false), IsMicromips(false),
-IsNan2008(false), IsSingleFloat(false), FloatABI(HardFloat),
-DspRev(NoDSP), HasMSA(false), HasFP64(false), ABI(ABIStr) {
+  MipsTargetInfo(const llvm::Triple &Triple, const TargetOptions &)
+  : TargetInfo(Triple), CPU((getTriple().getArch() == llvm::Triple::mips ||
+ getTriple().getArch() == llvm::Triple::mipsel)
+? "mips32r2"
+: "mips64r2"),
+IsMips16(false), IsMicromips(false), IsNan2008(false),
+IsSingleFloat(false), FloatABI(HardFloat), DspRev(NoDSP), HasMSA(false),
+HasFP64(false), ABI((getTriple().getArch() == llvm::Triple::mips ||
+ getTriple().getArch() == llvm::Triple::mipsel)
+? "o32"
+: "n64") {
 TheCXXABI.set(TargetCXXABI::GenericMIPS);
+BigEndian = getTriple().getArch() == llvm::Triple::mips ||
+getTriple().getArch() == llvm::Triple::mips64;
+
+if (getTriple().getArch() == llvm::Triple::mips ||
+getTriple().getArch() == llvm::Triple::mipsel) {
+  SizeType = UnsignedInt;
+  PtrDiffType = SignedInt;
+  Int64Type = SignedLongLong;
+  IntMaxType = Int64Type;
+  MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 32;
+} else if (getTriple().getArch() == llvm::Triple::mips64 ||
+   getTriple().getArch() == llvm::Triple::mips64el) {
+  LongDoubleWidth = LongDoubleAlign = 128;
+  LongDoubleFormat = &llvm::APFloat::IEEEquad;
+  if (getTriple().getOS() == llvm::Triple::FreeBSD) {
+LongDoubleWidth = LongDoubleAlign = 64;
+LongDoubleFormat = &llvm::APFloat::IEEEdouble;
+  }
+  setN64ABITypes();
+  SuitableAlign = 128;
+  MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64;
+}
   }
 
   bool isNaN2008Default() const {
@@ -6981,6 +7030,48 @@
   }
 
   StringRef getABI() const override { return ABI; }
+  bool setABI(const std::string &Name) override {
+if (getTriple().getArch() == llvm::Triple::mips ||
+getTriple().getArch() == llvm::Triple::mipsel) {
+  if (Name == "o32" || Name == "eabi") {
+ABI = Name;
+return true;
+  }
+}
+if (getTriple().getArch() == llvm::Triple::mips64 ||
+getTriple().getArch() == llvm::Triple::mips64el) {
+  if (Name == "n32") {
+setN32ABITypes();
+ABI = Name;
+return true;
+  }
+  if (Name == "n64") {
+setN64ABITypes();
+ABI = Name;
+return true;
+  }
+}
+return false;
+  }
+
+  void setN64ABITypes() {
+LongWidth = LongAlign = 64;
+PointerWidth = PointerAlign = 64;
+SizeType = UnsignedLong;
+PtrDiffType = SignedLong;
+Int64Type = SignedLong;
+IntMaxType = Int64Type;
+  }
+
+  void setN32ABITypes() {
+LongWidth = LongAlign = 32;
+PointerWidth = PointerAlign = 32;
+SizeType = UnsignedInt;
+PtrDiffType = SignedInt;
+Int64Type = SignedLongLong;
+IntMaxType = Int64Type;
+  }
+
   bool setCPU(const std::string &Name) override {
  

Re: [PATCH] D20630: [OpenCL] Allow -std=cl|CL1.1|CL1.2|CL2.0 in driver

2016-05-26 Thread Anastasia Stulova via cfe-commits
Anastasia added inline comments.


Comment at: lib/Frontend/CompilerInvocation.cpp:1587-1589
@@ -1579,3 +1586,4 @@
+.Case("cl", LangStandard::lang_opencl)
 .Case("CL1.1", LangStandard::lang_opencl11)
 .Case("CL1.2", LangStandard::lang_opencl12)
 .Case("CL2.0", LangStandard::lang_opencl20)

rsmith wrote:
> yaxunl wrote:
> > rsmith wrote:
> > > How about changing these to the lowercase form too, and treating the 
> > > uppercase versions as (deprecated) synonyms? (And likewise changing 
> > > LangStandards.def to list the lowercase versions, perhaps with the 
> > > uppercase versions as aliases.)
> > -cl-std=CL1.1|CL1.2|CL2.0 is defined by OpenCL spec. Allowing lower case 
> > may cause some confusion.
> > 
> > -cl-std=cl is not part of OpenCL spec.
> > 
> > How about keeping all -cl-std= options big letters and all -std= options 
> > small letters?
> What? The OpenCL spec does not get to dictate our command-line argument 
> syntax. If they think they do, they're just mistaken.
OpenCL spec s5.8.4.5 standardizes the compiler option controlling the OpenCL C 
version to be as Sam mentioned above:
  -cl-std=CL1.1|CL1.2|CL2.0

But this is a part of driver compilation API, and surely doesn't have anything 
to do with standalone Clang itself.

However, I must say using uppercase letters for CL version is quite common in 
OpenCL community while using lowercase format is more common for C community.

I don't have much preference here to be honest, as soon as we are consistent in 
one way or another. 


http://reviews.llvm.org/D20630



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


Re: [PATCH] D18575: [clang-tidy] New checker to replace deprecated throw() specifications

2016-05-26 Thread Aaron Ballman via cfe-commits
aaron.ballman added a comment.

http://reviews.llvm.org/D18575



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


Re: [PATCH] D20677: Make it possible to build a -fno-exceptions libc++abi variant.

2016-05-26 Thread Ben Craig via cfe-commits
bcraig added inline comments.


Comment at: CMakeLists.txt:359
@@ -350,2 +358,3 @@
 else()
-  add_subdirectory(test)
+  # libc++abi tests are mostly exceptions related. The only reason we want to
+  # build libc++abi without exceptions is to support the -fno-exceptions libc++

There's one area / test that I would still like to see when exceptions are off. 
 "magic" / thread safe static initialization has a test (test_guard.pass.cpp).  
I think it would be pretty easy to #if out the one sub-test that uses 
exceptions there.

There's also some demangling and backtracing tests, but I'm much less concerned 
with those.  If you go through the trouble to get any tests working with 
exceptions turned off, you might as well get those too.


Comment at: src/cxa_aux_runtime.cpp:19
@@ -18,2 +18,3 @@
 extern "C" {
 _LIBCXXABI_FUNC_VIS LIBCXXABI_NORETURN void __cxa_bad_cast(void) {
+#ifndef _LIBCXXABI_NO_EXCEPTIONS

So you're turning off exceptions, but leaving RTTI?  You might want to keep 
some of the RTTI tests around too if that's the case.


Comment at: src/cxa_new_delete.cpp:85
@@ -79,1 +84,3 @@
+#endif
 p = ::operator new(size);
+#ifndef _LIBCXXABI_NO_EXCEPTIONS

Question:  Should "throwing" new call terminate on allocation failure, or is 
returning null from "throwing" new fine?

I'm leaning towards returning null, as I would rapidly grow tired of 
std::nothrow everywhere, but it does seem a bit dangerous.


http://reviews.llvm.org/D20677



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


Re: [PATCH] D20678: [mips] Fold MipsTargetInfoBase subclasses into MipsTargetInfoBase and rename to MipsTargetInfo. NFC

2016-05-26 Thread Simon Atanasyan via cfe-commits
atanasyan added inline comments.


Comment at: lib/Basic/Targets.cpp:6986
@@ +6985,3 @@
+  : TargetInfo(Triple), CPU((getTriple().getArch() == llvm::Triple::mips ||
+ getTriple().getArch() == llvm::Triple::mipsel)
+? "mips32r2"

What do you think about creation a static function and using it to simplify 
this and similar conditions?

```
static bool is32BitTriple(const llvm::Triple &Triple) {
  return Triple.getArch() == llvm::Triple::mips || Triple.getArch() == 
llvm::Triple::mipsel;
}
```


Comment at: lib/Basic/Targets.cpp:7006
@@ +7005,3 @@
+  MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 32;
+} else if (getTriple().getArch() == llvm::Triple::mips64 ||
+   getTriple().getArch() == llvm::Triple::mips64el) {

Can we use just `else` here?


http://reviews.llvm.org/D20678



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


r270849 - [Analyzer] Correct stack address escape diagnostic

2016-05-26 Thread Sean Eveson via cfe-commits
Author: seaneveson
Date: Thu May 26 09:02:17 2016
New Revision: 270849

URL: http://llvm.org/viewvc/llvm-project?rev=270849&view=rev
Log:
[Analyzer] Correct stack address escape diagnostic

Summary:
Leaking a stack address via a static variable refers to it in the diagnostic as 
a 'global'. This patch corrects the diagnostic for static variables.


Patch by Phil Camp, SN Systems

Reviewers: dcoughlin, zaks.anna

Subscribers: xazax.hun, cfe-commits

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

Patch by Phil Camp

Modified:
cfe/trunk/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp
cfe/trunk/test/Analysis/stackaddrleak.c

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp?rev=270849&r1=270848&r2=270849&view=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp Thu May 26 
09:02:17 2016
@@ -236,7 +236,12 @@ void StackAddrEscapeChecker::checkEndFun
 SmallString<512> buf;
 llvm::raw_svector_ostream os(buf);
 SourceRange range = genName(os, cb.V[i].second, Ctx.getASTContext());
-os << " is still referred to by the global variable '";
+os << " is still referred to by the ";
+if (isa(cb.V[i].first->getMemorySpace()))
+  os << "static";
+else
+  os << "global";
+os << " variable '";
 const VarRegion *VR = cast(cb.V[i].first->getBaseRegion());
 os << *VR->getDecl()
<< "' upon returning to the caller.  This will be a dangling reference";

Modified: cfe/trunk/test/Analysis/stackaddrleak.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/stackaddrleak.c?rev=270849&r1=270848&r2=270849&view=diff
==
--- cfe/trunk/test/Analysis/stackaddrleak.c (original)
+++ cfe/trunk/test/Analysis/stackaddrleak.c Thu May 26 09:02:17 2016
@@ -19,7 +19,7 @@ void f2() {
   p = (const char *) __builtin_alloca(12);
 } // expected-warning{{Address of stack memory allocated by call to alloca() 
on line 19 is still referred to by the global variable 'p' upon returning to 
the caller.  This will be a dangling reference}}
 
-// PR 7383 - previosly the stack address checker would crash on this example
+// PR 7383 - previously the stack address checker would crash on this example
 //  because it would attempt to do a direct load from 'pr7383_list'. 
 static int pr7383(__const char *__)
 {
@@ -33,7 +33,7 @@ void test_multi_return() {
   int x;
   a = &x;
   b = &x;
-} // expected-warning{{Address of stack memory associated with local variable 
'x' is still referred to by the global variable 'a' upon returning}} 
expected-warning{{Address of stack memory associated with local variable 'x' is 
still referred to by the global variable 'b' upon returning}}
+} // expected-warning{{Address of stack memory associated with local variable 
'x' is still referred to by the static variable 'a' upon returning}} 
expected-warning{{Address of stack memory associated with local variable 'x' is 
still referred to by the static variable 'b' upon returning}}
 
 intptr_t returnAsNonLoc() {
   int x;


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


[PATCH] D20679: [mips] Kill 'support' for untested EABI.

2016-05-26 Thread Daniel Sanders via cfe-commits
dsanders created this revision.
dsanders added subscribers: cfe-commits, atanasyan.
dsanders added a dependency: D20678: [mips] Fold MipsTargetInfoBase subclasses 
into MipsTargetInfoBase and rename to MipsTargetInfo. NFC.

There are no clang or llvm* tests for EABI and no EABI buildbots.

*There is a single backend test that specifies EABI but it tests MIPS16.

Depends on D20678

http://reviews.llvm.org/D20679

Files:
  lib/Basic/Targets.cpp

Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -6941,16 +6941,16 @@
 class MipsTargetInfo : public TargetInfo {
   void setDataLayout() {
 if (BigEndian) {
-  if (ABI == "o32" || ABI == "eabi")
+  if (ABI == "o32")
 resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64");
   else if (ABI == "n32")
 resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128");
   else if (ABI == "n64")
 resetDataLayout("E-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128");
   else
 llvm_unreachable("Invalid ABI");
 } else {
-  if (ABI == "o32" || ABI == "eabi")
+  if (ABI == "o32")
 resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64");
   else if (ABI == "n32")
 resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128");
@@ -7033,7 +7033,7 @@
   bool setABI(const std::string &Name) override {
 if (getTriple().getArch() == llvm::Triple::mips ||
 getTriple().getArch() == llvm::Triple::mipsel) {
-  if (Name == "o32" || Name == "eabi") {
+  if (Name == "o32") {
 ABI = Name;
 return true;
   }
@@ -7150,9 +7150,7 @@
   Builder.defineMacro("__mips_o32");
   Builder.defineMacro("_ABIO32", "1");
   Builder.defineMacro("_MIPS_SIM", "_ABIO32");
-} else if (ABI == "eabi")
-  Builder.defineMacro("__mips_eabi");
-else if (ABI == "n32") {
+} else if (ABI == "n32") {
   Builder.defineMacro("__mips_n32");
   Builder.defineMacro("_ABIN32", "2");
   Builder.defineMacro("_MIPS_SIM", "_ABIN32");


Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -6941,16 +6941,16 @@
 class MipsTargetInfo : public TargetInfo {
   void setDataLayout() {
 if (BigEndian) {
-  if (ABI == "o32" || ABI == "eabi")
+  if (ABI == "o32")
 resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64");
   else if (ABI == "n32")
 resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128");
   else if (ABI == "n64")
 resetDataLayout("E-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128");
   else
 llvm_unreachable("Invalid ABI");
 } else {
-  if (ABI == "o32" || ABI == "eabi")
+  if (ABI == "o32")
 resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64");
   else if (ABI == "n32")
 resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128");
@@ -7033,7 +7033,7 @@
   bool setABI(const std::string &Name) override {
 if (getTriple().getArch() == llvm::Triple::mips ||
 getTriple().getArch() == llvm::Triple::mipsel) {
-  if (Name == "o32" || Name == "eabi") {
+  if (Name == "o32") {
 ABI = Name;
 return true;
   }
@@ -7150,9 +7150,7 @@
   Builder.defineMacro("__mips_o32");
   Builder.defineMacro("_ABIO32", "1");
   Builder.defineMacro("_MIPS_SIM", "_ABIO32");
-} else if (ABI == "eabi")
-  Builder.defineMacro("__mips_eabi");
-else if (ABI == "n32") {
+} else if (ABI == "n32") {
   Builder.defineMacro("__mips_n32");
   Builder.defineMacro("_ABIN32", "2");
   Builder.defineMacro("_MIPS_SIM", "_ABIN32");
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20334: [libcxx] Fix a bug in strstreambuf::overflow

2016-05-26 Thread Ben Craig via cfe-commits
bcraig added a comment.

So I definitely see a problem, and I think your fix is a reasonable solution to 
that problem.  I'm still unclear on how that caused the ASAN error though.  
Here's my understanding of the current problem...

The initial buffer for strstreambuf is often 4096  ( _strstream> line 184, 
__default_alsize = 4096;).
So we have a 4096 character string, and push that into strstreambuf.  There 
shouldn't be any calls to overflow because of that.
Now, we push in an ends().  This causes a call to overflow().  overflow() 
allocates a new buffer of twice the size, then saves off the relevant put and 
get range sizes for the old buffer.  The old capacity ranges (einp and eout) 
should add up to 4096.  We then set the new range sizes using the old range 
sizes.  THIS SEEMS WRONG.  We have an 8K buffer, but we are only setting it 
with 4K sizes.  We then write ends() into the no-mans-land past the end of 
epptr() (well, exactly at epptr), and then advance pptr() past epptr().

I can see this causing a lot of trouble, as some code compares pptr() == 
epptr(), and we've broken that.

However, I would expect ASAN to require an extra call to overflow() before 
things explode.  strlen should still find that end() that we placed.  Maybe 
there's an extra overflow() that I didn't see though.

I would like to see a new test added to exercise this use case.  The test 
should probably live somewhere under 
test/std/depr/depr.str.strstreams/depr.strstreambuf.  Your example code is 
going to be pretty close to what you would want to put there (maybe a 
string.resize instead of the stringOfLength() function you have).  I believe 
you can run the tests using address sanitizer by setting 
LLVM_USE_SANITIZER="Address" to your cmake line.  "make check-libcxx" will then 
compile the tests (and libcxx?) with ASAN.



Comment at: src/strstream.cpp:174
@@ -173,3 +173,3 @@
 ptrdiff_t nout = pptr()  - pbase();
 ptrdiff_t eout = epptr() - pbase();
 if (__strmode_ & __allocated)

This is now unused.


http://reviews.llvm.org/D20334



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


Re: [PATCH] D20679: [mips] Kill 'support' for untested EABI.

2016-05-26 Thread Simon Atanasyan via cfe-commits
atanasyan accepted this revision.
atanasyan added a reviewer: atanasyan.
atanasyan added a comment.
This revision is now accepted and ready to land.

LGTM

Tools.cpp contains the following code. We need to remove `eabi` here too.

  if (CPUName.empty()) {
// Deduce CPU name from ABI name.
CPUName = llvm::StringSwitch(ABIName)
  .Cases("o32", "eabi", DefMips32CPU)
  .Cases("n32", "n64", DefMips64CPU)
  .Default("");
  }


http://reviews.llvm.org/D20679



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


[PATCH] D20680: [mips] Slightly simplify MipsTargetInfo::setDataLayout(). NFC.

2016-05-26 Thread Daniel Sanders via cfe-commits
dsanders created this revision.
dsanders added subscribers: cfe-commits, atanasyan.
dsanders added a dependency: D20679: [mips] Kill 'support' for untested EABI..

Depends on D20679

http://reviews.llvm.org/D20680

Files:
  lib/Basic/Targets.cpp

Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -6940,25 +6940,21 @@
 
 class MipsTargetInfo : public TargetInfo {
   void setDataLayout() {
-if (BigEndian) {
-  if (ABI == "o32")
-resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64");
-  else if (ABI == "n32")
-resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128");
-  else if (ABI == "n64")
-resetDataLayout("E-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128");
-  else
-llvm_unreachable("Invalid ABI");
-} else {
-  if (ABI == "o32")
-resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64");
-  else if (ABI == "n32")
-resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128");
-  else if (ABI == "n64")
-resetDataLayout("e-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128");
-  else
-llvm_unreachable("Invalid ABI");
-}
+StringRef Layout;
+
+if (ABI == "o32")
+  Layout = "m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64";
+else if (ABI == "n32")
+  Layout = "m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128";
+else if (ABI == "n64")
+  Layout = "m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128";
+else
+  llvm_unreachable("Invalid ABI");
+
+if (BigEndian)
+  resetDataLayout(("E-" + Layout).str());
+else
+  resetDataLayout(("e-" + Layout).str());
   }
 
 


Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -6940,25 +6940,21 @@
 
 class MipsTargetInfo : public TargetInfo {
   void setDataLayout() {
-if (BigEndian) {
-  if (ABI == "o32")
-resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64");
-  else if (ABI == "n32")
-resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128");
-  else if (ABI == "n64")
-resetDataLayout("E-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128");
-  else
-llvm_unreachable("Invalid ABI");
-} else {
-  if (ABI == "o32")
-resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64");
-  else if (ABI == "n32")
-resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128");
-  else if (ABI == "n64")
-resetDataLayout("e-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128");
-  else
-llvm_unreachable("Invalid ABI");
-}
+StringRef Layout;
+
+if (ABI == "o32")
+  Layout = "m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64";
+else if (ABI == "n32")
+  Layout = "m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128";
+else if (ABI == "n64")
+  Layout = "m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128";
+else
+  llvm_unreachable("Invalid ABI");
+
+if (BigEndian)
+  resetDataLayout(("E-" + Layout).str());
+else
+  resetDataLayout(("e-" + Layout).str());
   }
 
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D19866: [Analyzer] Correct stack address escape diagnostic

2016-05-26 Thread Sean Eveson via cfe-commits
seaneveson added a subscriber: seaneveson.
seaneveson closed this revision.
seaneveson added a comment.

Committed: http://reviews.llvm.org/rL270849


http://reviews.llvm.org/D19866



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


Re: [PATCH] D20338: [PCH] Fixed overridden files always invalidating preamble even when unchanged

2016-05-26 Thread Cameron via cfe-commits
cameron314 added a comment.

Thanks @bruno, I'll have a look at using a VFS for the test.



Comment at: lib/Basic/FileManager.cpp:389
@@ -383,2 +388,3 @@
   UFE->File.reset();
+  UFE->IsVirtual = true;
   return UFE;

rsmith wrote:
> Rather than adding this `IsVirtual` flag, could you just set `UFE->IsValid` 
> to `true` here?  It looks like a simple oversight that this code fails to set 
> the `IsValid` flag properly.
I could, but I didn't want to accidentally break something else that depends on 
virtual files not being valid. That's the type of change that can easily 
introduce a subtle bug not caught by the tests.

Semantically, is a virtual file always valid?


Repository:
  rL LLVM

http://reviews.llvm.org/D20338



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


Re: [PATCH] D20680: [mips] Slightly simplify MipsTargetInfo::setDataLayout(). NFC.

2016-05-26 Thread Simon Atanasyan via cfe-commits
atanasyan accepted this revision.
atanasyan added a reviewer: atanasyan.
atanasyan added a comment.
This revision is now accepted and ready to land.

LGTM


http://reviews.llvm.org/D20680



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


[PATCH] D20681: Add target-specific pre-linking passes to Clang

2016-05-26 Thread Yaxun Liu via cfe-commits
yaxunl created this revision.
yaxunl added reviewers: rsmith, Anastasia.
yaxunl added subscribers: cfe-commits, tstellarAMD.

Sometimes a backend needs to apply certain target-specific passes before 
linking. This patch attempts to add that.

It depends on a new virtual member function addPreLinkPasses to be added to 
TargetMachine, which will be implemented by a separate patch for llvm.

http://reviews.llvm.org/D20681

Files:
  include/clang/CodeGen/BackendUtil.h
  lib/CodeGen/BackendUtil.cpp
  lib/CodeGen/CodeGenAction.cpp

Index: lib/CodeGen/CodeGenAction.cpp
===
--- lib/CodeGen/CodeGenAction.cpp
+++ lib/CodeGen/CodeGenAction.cpp
@@ -165,19 +165,20 @@
   void *OldDiagnosticContext = Ctx.getDiagnosticContext();
   Ctx.setDiagnosticHandler(DiagnosticHandler, this);
 
-  // Link LinkModule into this module if present, preserving its validity.
-  for (auto &I : LinkModules) {
-unsigned LinkFlags = I.first;
-CurLinkModule = I.second.get();
-if (Linker::linkModules(*getModule(), std::move(I.second), LinkFlags))
-  return;
-  }
-
-  EmbedBitcode(getModule(), CodeGenOpts, llvm::MemoryBufferRef());
-
+  std::function
+LinkCallBack = [=](llvm::Module *M)->bool {
+// Link LinkModule into this module if present, preserving its validity.
+for (auto &I : LinkModules) {
+  unsigned LinkFlags = I.first;
+  CurLinkModule = I.second.get();
+  if (Linker::linkModules(*getModule(), std::move(I.second), LinkFlags))
+return true;
+}
+return false;
+  };
   EmitBackendOutput(Diags, CodeGenOpts, TargetOpts, LangOpts,
 C.getTargetInfo().getDataLayout(),
-getModule(), Action, AsmOutStream);
+getModule(), Action, AsmOutStream, &LinkCallBack);
 
   Ctx.setInlineAsmDiagnosticHandler(OldHandler, OldContext);
 
Index: lib/CodeGen/BackendUtil.cpp
===
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -59,8 +59,10 @@
   const LangOptions &LangOpts;
   Module *TheModule;
 
+  Timer PreLinkTime;
   Timer CodeGenerationTime;
 
+  mutable legacy::PassManager *PreLinkPasses;
   mutable legacy::PassManager *CodeGenPasses;
   mutable legacy::PassManager *PerModulePasses;
   mutable legacy::FunctionPassManager *PerFunctionPasses;
@@ -100,8 +102,14 @@
 return PerFunctionPasses;
   }
 
-  /// Set LLVM command line options passed through -backend-option.
-  void setCommandLineOpts();
+  legacy::PassManager *getPreLinkPasses() const {
+if (!PreLinkPasses) {
+  PreLinkPasses = new legacy::PassManager();
+  PreLinkPasses->add(
+  createTargetTransformInfoWrapperPass(getTargetIRAnalysis()));
+}
+return PreLinkPasses;
+  }
 
   void CreatePasses(ModuleSummaryIndex *ModuleSummary);
 
@@ -120,16 +128,21 @@
   /// \return True on success.
   bool AddEmitPasses(BackendAction Action, raw_pwrite_stream &OS);
 
+  /// Add target specific pre-linking passes.
+  void AddPreLinkPasses(raw_pwrite_stream &OS);
+
 public:
   EmitAssemblyHelper(DiagnosticsEngine &_Diags, const CodeGenOptions &CGOpts,
  const clang::TargetOptions &TOpts,
  const LangOptions &LOpts, Module *M)
   : Diags(_Diags), CodeGenOpts(CGOpts), TargetOpts(TOpts), LangOpts(LOpts),
-TheModule(M), CodeGenerationTime("Code Generation Time"),
+TheModule(M), PreLinkTime("Pre-Linking Passes Time"),
+CodeGenerationTime("Code Generation Time"), PreLinkPasses(nullptr),
 CodeGenPasses(nullptr), PerModulePasses(nullptr),
 PerFunctionPasses(nullptr) {}
 
   ~EmitAssemblyHelper() {
+delete PreLinkPasses;
 delete CodeGenPasses;
 delete PerModulePasses;
 delete PerFunctionPasses;
@@ -140,6 +153,14 @@
   std::unique_ptr TM;
 
   void EmitAssembly(BackendAction Action, raw_pwrite_stream *OS);
+  void DoPreLinkPasses(raw_pwrite_stream *OS);
+
+  /// Set LLVM command line options passed through -backend-option.
+  void setCommandLineOpts();
+
+  /// Set up target for target specific pre-linking passes and LLVM code
+  /// generation.
+  void setTarget(BackendAction Action);
 };
 
 // We need this wrapper to access LangOpts and CGOpts from extension functions
@@ -504,6 +525,14 @@
 BackendArgs.data());
 }
 
+void EmitAssemblyHelper::setTarget(BackendAction Action) {
+  bool UsesCodeGen = (Action != Backend_EmitNothing &&
+  Action != Backend_EmitBC &&
+  Action != Backend_EmitLL);
+  if (!TM)
+TM.reset(CreateTargetMachine(UsesCodeGen));
+}
+
 TargetMachine *EmitAssemblyHelper::CreateTargetMachine(bool MustCreateTM) {
   // Create the TargetMachine for generating code.
   std::string Error;
@@ -625,6 +654,7 @@
   return TM;
 }
 
+
 bool EmitAssemblyHel

Re: [PATCH] D20277: [clang-tidy] UnnecessaryValueParamCheck - suggest std::move() if non-const value parameter can be moved.

2016-05-26 Thread Felix Berger via cfe-commits
flx added a comment.

This is ready for review again.


http://reviews.llvm.org/D20277



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


r270851 - Adding missing _mm512_castsi512_si256 intrinsic.

2016-05-26 Thread Michael Zuckerman via cfe-commits
Author: mzuckerm
Date: Thu May 26 09:32:11 2016
New Revision: 270851

URL: http://llvm.org/viewvc/llvm-project?rev=270851&view=rev
Log:
Adding missing _mm512_castsi512_si256 intrinsic. 



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

Modified: cfe/trunk/lib/Headers/avx512fintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512fintrin.h?rev=270851&r1=270850&r2=270851&view=diff
==
--- cfe/trunk/lib/Headers/avx512fintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512fintrin.h Thu May 26 09:32:11 2016
@@ -445,6 +445,12 @@ _mm512_castsi512_si128 (__m512i __A)
   return (__m128i)__builtin_shufflevector(__A, __A , 0, 1);
 }
 
+static __inline __m256i __DEFAULT_FN_ATTRS
+_mm512_castsi512_si256 (__m512i __A)
+{
+  return (__m256i)__builtin_shufflevector(__A, __A , 0, 1, 2, 3);
+}
+
 /* Bitwise operators */
 static __inline__ __m512i __DEFAULT_FN_ATTRS
 _mm512_and_epi32(__m512i __a, __m512i __b)

Modified: cfe/trunk/test/CodeGen/avx512f-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512f-builtins.c?rev=270851&r1=270850&r2=270851&view=diff
==
--- cfe/trunk/test/CodeGen/avx512f-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx512f-builtins.c Thu May 26 09:32:11 2016
@@ -6041,6 +6041,13 @@ __m128i test_mm512_castsi512_si128 (__m5
   return _mm512_castsi512_si128 (__A);
 }
 
+__m256i test_mm512_castsi512_si256 (__m512i __A)
+{
+  // CHECK-LABEL: @test_mm512_castsi512_si256 
+  // CHECK: shufflevector <8 x i64> %{{.}}, <8 x i64> %{{.}}, <4 x i32> 
+  return _mm512_castsi512_si256 (__A);
+}
+
 __m128 test_mm_cvt_roundsd_ss(__m128 __A, __m128d __B) {
   // CHECK-LABEL: @test_mm_cvt_roundsd_ss
   // CHECK: @llvm.x86.avx512.mask.cvtsd2ss.round


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


Re: [PATCH] D20632: clang-format: [JS] Support shebang lines on the very first line.

2016-05-26 Thread Martin Probst via cfe-commits
mprobst marked 2 inline comments as done.


Comment at: lib/Format/TokenAnnotator.cpp:698
@@ +697,3 @@
+
+if (Style.Language == FormatStyle::LK_JavaScript) {
+  // JavaScript files can contain shebang lines of the form:

alexeagle wrote:
> should we still restrict it to be on the first line?
> 
> I suppose if you start some other line with #, that's not valid JS or TS so 
> it doesn't matter what clang-format does to it? Maybe it's fine like this.
Done. Doesn't make a big difference I guess, but it's better to be conservative.


http://reviews.llvm.org/D20632



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


Re: [PATCH] D20678: [mips] Fold MipsTargetInfoBase subclasses into MipsTargetInfoBase and rename to MipsTargetInfo. NFC

2016-05-26 Thread Daniel Sanders via cfe-commits
dsanders added inline comments.


Comment at: lib/Basic/Targets.cpp:6986
@@ +6985,3 @@
+  : TargetInfo(Triple), CPU((getTriple().getArch() == llvm::Triple::mips ||
+ getTriple().getArch() == llvm::Triple::mipsel)
+? "mips32r2"

atanasyan wrote:
> What do you think about creation a static function and using it to simplify 
> this and similar conditions?
> 
> ```
> static bool is32BitTriple(const llvm::Triple &Triple) {
>   return Triple.getArch() == llvm::Triple::mips || Triple.getArch() == 
> llvm::Triple::mipsel;
> }
> ```
I'm happy to add one if you want it but I'm currently finishing a patch that 
removes most of them in favour of ABI checks. The only one I think should 
remain as an Arch check is the one for MipsTargetInfo::ABI. Even that one is 
incorrect on our buildbots which detect as mips64-linux-gnu but should default 
to O32.


Comment at: lib/Basic/Targets.cpp:7006
@@ +7005,3 @@
+  MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 32;
+} else if (getTriple().getArch() == llvm::Triple::mips64 ||
+   getTriple().getArch() == llvm::Triple::mips64el) {

atanasyan wrote:
> Can we use just `else` here?
Sure


http://reviews.llvm.org/D20678



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


Re: [PATCH] D20632: clang-format: [JS] Support shebang lines on the very first line.

2016-05-26 Thread Martin Probst via cfe-commits
mprobst updated this revision to Diff 58612.
mprobst marked an inline comment as done.
mprobst added a comment.

revert FormatTokenLexer, restrict to first token


http://reviews.llvm.org/D20632

Files:
  lib/Format/FormatToken.h
  lib/Format/TokenAnnotator.cpp
  unittests/Format/FormatTestJS.cpp

Index: unittests/Format/FormatTestJS.cpp
===
--- unittests/Format/FormatTestJS.cpp
+++ unittests/Format/FormatTestJS.cpp
@@ -1272,5 +1272,12 @@
   verifyFormat("var x = 'foo';", LeaveQuotes);
 }
 
+TEST_F(FormatTestJS, SupportShebangLines) {
+  verifyFormat("#!/usr/bin/env node\n"
+   "var x = hello();",
+   "#!/usr/bin/env node\n"
+   "var x   =  hello();");
+}
+
 } // end namespace tooling
 } // end namespace clang
Index: lib/Format/TokenAnnotator.cpp
===
--- lib/Format/TokenAnnotator.cpp
+++ lib/Format/TokenAnnotator.cpp
@@ -690,10 +690,24 @@
   }
 
   LineType parsePreprocessorDirective() {
+bool IsFirstToken = CurrentToken->IsFirst;
 LineType Type = LT_PreprocessorDirective;
 next();
 if (!CurrentToken)
   return Type;
+
+if (Style.Language == FormatStyle::LK_JavaScript && IsFirstToken) {
+  // JavaScript files can contain shebang lines of the form:
+  // #!/usr/bin/env node
+  // Treat these like C++ #include directives.
+  while (CurrentToken) {
+// Tokens cannot be comments here.
+CurrentToken->Type = TT_ImplicitStringLiteral;
+next();
+  }
+  return LT_ImportStatement;
+}
+
 if (CurrentToken->Tok.is(tok::numeric_constant)) {
   CurrentToken->SpacesRequiredBefore = 1;
   return Type;
Index: lib/Format/FormatToken.h
===
--- lib/Format/FormatToken.h
+++ lib/Format/FormatToken.h
@@ -145,7 +145,7 @@
   /// \brief Whether the token text contains newlines (escaped or not).
   bool IsMultiline = false;
 
-  /// \brief Indicates that this is the first token.
+  /// \brief Indicates that this is the first token of the file.
   bool IsFirst = false;
 
   /// \brief Whether there must be a line break before this token.


Index: unittests/Format/FormatTestJS.cpp
===
--- unittests/Format/FormatTestJS.cpp
+++ unittests/Format/FormatTestJS.cpp
@@ -1272,5 +1272,12 @@
   verifyFormat("var x = 'foo';", LeaveQuotes);
 }
 
+TEST_F(FormatTestJS, SupportShebangLines) {
+  verifyFormat("#!/usr/bin/env node\n"
+   "var x = hello();",
+   "#!/usr/bin/env node\n"
+   "var x   =  hello();");
+}
+
 } // end namespace tooling
 } // end namespace clang
Index: lib/Format/TokenAnnotator.cpp
===
--- lib/Format/TokenAnnotator.cpp
+++ lib/Format/TokenAnnotator.cpp
@@ -690,10 +690,24 @@
   }
 
   LineType parsePreprocessorDirective() {
+bool IsFirstToken = CurrentToken->IsFirst;
 LineType Type = LT_PreprocessorDirective;
 next();
 if (!CurrentToken)
   return Type;
+
+if (Style.Language == FormatStyle::LK_JavaScript && IsFirstToken) {
+  // JavaScript files can contain shebang lines of the form:
+  // #!/usr/bin/env node
+  // Treat these like C++ #include directives.
+  while (CurrentToken) {
+// Tokens cannot be comments here.
+CurrentToken->Type = TT_ImplicitStringLiteral;
+next();
+  }
+  return LT_ImportStatement;
+}
+
 if (CurrentToken->Tok.is(tok::numeric_constant)) {
   CurrentToken->SpacesRequiredBefore = 1;
   return Type;
Index: lib/Format/FormatToken.h
===
--- lib/Format/FormatToken.h
+++ lib/Format/FormatToken.h
@@ -145,7 +145,7 @@
   /// \brief Whether the token text contains newlines (escaped or not).
   bool IsMultiline = false;
 
-  /// \brief Indicates that this is the first token.
+  /// \brief Indicates that this is the first token of the file.
   bool IsFirst = false;
 
   /// \brief Whether there must be a line break before this token.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20678: [mips] Fold MipsTargetInfoBase subclasses into MipsTargetInfoBase and rename to MipsTargetInfo. NFC

2016-05-26 Thread Simon Atanasyan via cfe-commits
atanasyan accepted this revision.
atanasyan added a reviewer: atanasyan.
atanasyan added a comment.
This revision is now accepted and ready to land.

LGTM



Comment at: lib/Basic/Targets.cpp:6986
@@ +6985,3 @@
+  : TargetInfo(Triple), CPU((getTriple().getArch() == llvm::Triple::mips ||
+ getTriple().getArch() == llvm::Triple::mipsel)
+? "mips32r2"

dsanders wrote:
> atanasyan wrote:
> > What do you think about creation a static function and using it to simplify 
> > this and similar conditions?
> > 
> > ```
> > static bool is32BitTriple(const llvm::Triple &Triple) {
> >   return Triple.getArch() == llvm::Triple::mips || Triple.getArch() == 
> > llvm::Triple::mipsel;
> > }
> > ```
> I'm happy to add one if you want it but I'm currently finishing a patch that 
> removes most of them in favour of ABI checks. The only one I think should 
> remain as an Arch check is the one for MipsTargetInfo::ABI. Even that one is 
> incorrect on our buildbots which detect as mips64-linux-gnu but should 
> default to O32.
Agreed. In that case the separate function is redundant.


http://reviews.llvm.org/D20678



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


Re: [PATCH] D20010: [clang-tidy] UnnecessaryCopyInitialization - Extend to trigger on non-const "this" object argument if it is not modified

2016-05-26 Thread Felix Berger via cfe-commits
flx added a comment.

Friendly ping.


http://reviews.llvm.org/D20010



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


[PATCH] D20683: [MSVC2015] Fix mangling for static variables initialization guards

2016-05-26 Thread Dmitry Polukhin via cfe-commits
DmitryPolukhin created this revision.
DmitryPolukhin added a reviewer: majnemer.
DmitryPolukhin added subscribers: cfe-commits, rnk.

It seems that suffix '@4HA' was omitted for unknown reason. It is non-const 
non-volatile 'int' type of normal variable TSS.

http://reviews.llvm.org/D20683

Files:
  lib/AST/MicrosoftMangle.cpp
  test/CodeGenCXX/microsoft-abi-thread-safe-statics.cpp

Index: test/CodeGenCXX/microsoft-abi-thread-safe-statics.cpp
===
--- test/CodeGenCXX/microsoft-abi-thread-safe-statics.cpp
+++ test/CodeGenCXX/microsoft-abi-thread-safe-statics.cpp
@@ -9,12 +9,14 @@
 // CHECK-DAG: @"\01?s@?1??f@@YAAAUS@@XZ@4U2@A" = linkonce_odr thread_local 
global %struct.S zeroinitializer
 // CHECK-DAG: @"\01??__J?1??f@@YAAAUS@@XZ@51" = linkonce_odr thread_local 
global i32 0
 // CHECK-DAG: @"\01?s@?1??g@@YAAAUS@@XZ@4U2@A" = linkonce_odr global %struct.S 
zeroinitializer
-// CHECK-DAG: @"\01?$TSS0@?1??g@@YAAAUS@@XZ" = linkonce_odr global i32 0
+// CHECK-DAG: @"\01?$TSS0@?1??g@@YAAAUS@@XZ@4HA" = linkonce_odr global i32 0
 // CHECK-DAG: @_Init_thread_epoch = external thread_local global i32, align 4
 // CHECK-DAG: @"\01?j@?1??h@@YAAAUS@@_N@Z@4U2@A" = linkonce_odr thread_local 
global %struct.S zeroinitializer
 // CHECK-DAG: @"\01??__J?1??h@@YAAAUS@@_N@Z@51" = linkonce_odr thread_local 
global i32 0
 // CHECK-DAG: @"\01?i@?1??h@@YAAAUS@@_N@Z@4U2@A" = linkonce_odr global 
%struct.S zeroinitializer
-// CHECK-DAG: @"\01?$TSS0@?1??h@@YAAAUS@@_N@Z" = linkonce_odr global i32 0
+// CHECK-DAG: @"\01?$TSS0@?1??h@@YAAAUS@@_N@Z@4HA" = linkonce_odr global i32 0
+// CHECK-DAG: @"\01?i@?1??g1@@YAHXZ@4HA" = internal global i32 0, align 4
+// CHECK-DAG: @"\01?$TSS0@?1??g1@@YAHXZ@4HA" = internal global i32 0, align 4
 
 // CHECK-LABEL: define {{.*}} @"\01?f@@YAAAUS@@XZ"()
 // CHECK-SAME:  personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*)
@@ -51,14 +53,14 @@
 // CHECK-LABEL: define {{.*}} @"\01?g@@YAAAUS@@XZ"()
 extern inline S &g() {
   static S s;
-// CHECK:  %[[guard:.*]] = load atomic i32, i32* 
@"\01?$TSS0@?1??g@@YAAAUS@@XZ" unordered, align 4
+// CHECK:  %[[guard:.*]] = load atomic i32, i32* 
@"\01?$TSS0@?1??g@@YAAAUS@@XZ@4HA" unordered, align 4
 // CHECK-NEXT:  %[[epoch:.*]] = load i32, i32* @_Init_thread_epoch
 // CHECK-NEXT:  %[[cmp:.*]] = icmp sgt i32 %[[guard]], %[[epoch]]
 // CHECK-NEXT:  br i1 %[[cmp]], label %[[init_attempt:.*]], label 
%[[init_end:.*]]
 //
 // CHECK: [[init_attempt]]:
-// CHECK-NEXT:  call void @_Init_thread_header(i32* 
@"\01?$TSS0@?1??g@@YAAAUS@@XZ")
-// CHECK-NEXT:  %[[guard2:.*]] = load atomic i32, i32* 
@"\01?$TSS0@?1??g@@YAAAUS@@XZ" unordered, align 4
+// CHECK-NEXT:  call void @_Init_thread_header(i32* 
@"\01?$TSS0@?1??g@@YAAAUS@@XZ@4HA")
+// CHECK-NEXT:  %[[guard2:.*]] = load atomic i32, i32* 
@"\01?$TSS0@?1??g@@YAAAUS@@XZ@4HA" unordered, align 4
 // CHECK-NEXT:  %[[cmp2:.*]] = icmp eq i32 %[[guard2]], -1
 // CHECK-NEXT:  br i1 %[[cmp2]], label %[[init:.*]], label %[[init_end:.*]]
 //
@@ -68,15 +70,15 @@
 //
 // CHECK: [[invoke_cont]]:
 // CHECK-NEXT:  call i32 @atexit(void ()* @"\01??__Fs@?1??g@@YAAAUS@@XZ@YAXXZ")
-// CHECK-NEXT:  call void @_Init_thread_footer(i32* 
@"\01?$TSS0@?1??g@@YAAAUS@@XZ")
+// CHECK-NEXT:  call void @_Init_thread_footer(i32* 
@"\01?$TSS0@?1??g@@YAAAUS@@XZ@4HA")
 // CHECK-NEXT:  br label %init.end
 //
 // CHECK: [[init_end]]:
 // CHECK-NEXT:  ret %struct.S* @"\01?s@?1??g@@YAAAUS@@XZ@4U2@A"
 //
 // CHECK: [[lpad]]:
 // CHECK-NEXT: cleanuppad within none []
-// CHECK:   call void @_Init_thread_abort(i32* 
@"\01?$TSS0@?1??g@@YAAAUS@@XZ")
+// CHECK:   call void @_Init_thread_abort(i32* 
@"\01?$TSS0@?1??g@@YAAAUS@@XZ@4HA")
 // CHECK-NEXT:  cleanupret {{.*}} unwind to caller
   return s;
 }
@@ -86,3 +88,10 @@
   static S i;
   return b ? j : i;
 }
+
+// CHECK-LABEL: define i32 @"\01?g1@@YAHXZ"()
+int f1();
+int g1() {
+  static int i = f1();
+  return i;
+}
Index: lib/AST/MicrosoftMangle.cpp
===
--- lib/AST/MicrosoftMangle.cpp
+++ lib/AST/MicrosoftMangle.cpp
@@ -2837,6 +2837,7 @@
 
   Mangler.getStream() << "\01?$TSS" << GuardNum << '@';
   Mangler.mangleNestedName(VD);
+  Mangler.getStream() << "@4HA";
 }
 
 void MicrosoftMangleContextImpl::mangleStaticGuardVariable(const VarDecl *VD,


Index: test/CodeGenCXX/microsoft-abi-thread-safe-statics.cpp
===
--- test/CodeGenCXX/microsoft-abi-thread-safe-statics.cpp
+++ test/CodeGenCXX/microsoft-abi-thread-safe-statics.cpp
@@ -9,12 +9,14 @@
 // CHECK-DAG: @"\01?s@?1??f@@YAAAUS@@XZ@4U2@A" = linkonce_odr thread_local global %struct.S zeroinitializer
 // CHECK-DAG: @"\01??__J?1??f@@YAAAUS@@XZ@51" = linkonce_odr thread_local global i32 0
 // CHECK-DAG: @"\01?s@?1??g@@YAAAUS@@XZ@4U2@A" = linkonce_odr global %struct.S zeroinitializer
-// CHECK-DAG: @"\01?$TSS0@?1??g@@YAAAUS@@XZ" = linkonce_odr global i32 0
+/

Re: [PATCH] D18641: [PP] Handle #include_next after include found relative to current one same as GCC

2016-05-26 Thread Dmitry Polukhin via cfe-commits
DmitryPolukhin abandoned this revision.
DmitryPolukhin added a comment.

It seems that there is no interest in this patch, abandon.


http://reviews.llvm.org/D18641



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


Re: [PATCH] D20602: Add .rgba syntax extension to ext_vector_type types

2016-05-26 Thread Anastasia Stulova via cfe-commits
Anastasia added a subscriber: Anastasia.


Comment at: include/clang/Basic/DiagnosticSemaKinds.td:7900
@@ -7897,1 +7899,3 @@
+def ext_opencl_ext_vector_type_rgba_selector: ExtWarn<
+  "vector component name '%0' is an OpenCL 2.2 extension">;
 } // end of sema category

Could it be an error instead for CL <2.2? It isn't a valid feature and we have 
already rejected similar cases with an error. 

How about changing to something like:
  "vector component name '%0' is not supported in earlier than OpenCL version 
2.2"

See similar diagnostics above - err_opencl_invalid_read_write, 
err_opencl_unknown_type_specifier.

Using extension might be confusing because we have core spec and extension spec 
in OpenCL.


http://reviews.llvm.org/D20602



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


Re: [PATCH] D20681: Add target-specific pre-linking passes to Clang

2016-05-26 Thread Tom Stellard via cfe-commits
tstellarAMD added a comment.

Can you give some examples of what pre-link passes may be required?


http://reviews.llvm.org/D20681



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


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

2016-05-26 Thread Roger Ferrer Ibanez via cfe-commits
rogfer01 marked 4 inline comments as done.


Comment at: lib/Sema/SemaExpr.cpp:10527
@@ +10526,3 @@
+ME->getMemberDecl()->hasAttr()) {
+  Diag(OpLoc, diag::warn_taking_address_of_packed_member)
+  << ME->getMemberDecl() << RD;

aaron.ballman wrote:
> I wonder if we should diagnose only when the resulting pointer is actually 
> misaligned. For instance, the following code should be just fine:
> ```
> struct __attribute__((packed)) S {
>   int i;
> };
> 
> void f(S s) {
>   int *ip = &s.i; // Why should this warn?
> }
> ```
> Have you run this patch over any large code bases to see how high the 
> false-positive rate is? How do you envision users silencing this diagnostic 
> if they have a false-positive? Something like `&(s.x)` (since I you're not 
> ignoring paren imp casts)?
I think it should warn because in this case &s == &s.i and the alignment of the 
whole struct is 1 (due to the packed attribute) so s.i is also aligned to 1 
which would not be the suitable alignment for an int.

I'm currently building Firefox, I'll add a comment once it ends.

Regarding silencing the diagnostic: -Wno-address-of-packed-member should do but 
I understand it might be too coarse in some cases.


http://reviews.llvm.org/D20561



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


RE: r270838 - [OPENMP] Add option '-fopenmp-version=[31|40|45]' allowing choosing

2016-05-26 Thread Daniel Sanders via cfe-commits
Hi,

I think this commit may have caused the failure in 
http://lab.llvm.org:8011/builders/clang-cmake-mips/builds/13743. Could you 
check? Buildbot will have supressed the usual email because the previous build 
failed (for a different reason).

> -Original Message-
> From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf
> Of Alexey Bataev via cfe-commits
> Sent: 26 May 2016 12:10
> To: cfe-commits@lists.llvm.org
> Subject: r270838 - [OPENMP] Add option '-fopenmp-version=[31|40|45]'
> allowing choosing
> 
> Author: abataev
> Date: Thu May 26 06:10:11 2016
> New Revision: 270838
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=270838&view=rev
> Log:
> [OPENMP] Add option '-fopenmp-version=[31|40|45]' allowing choosing
> OpenMP version.
> 
> If '-fopenmp' option is provided '-fopenmp-version=' allows to control,
> which version of OpenMP must be supported. Currently it affects only the
> value of _OPENMP define.
> 
> Modified:
> cfe/trunk/include/clang/Basic/LangOptions.def
> cfe/trunk/include/clang/Driver/Options.td
> cfe/trunk/lib/Driver/Tools.cpp
> cfe/trunk/lib/Frontend/CompilerInvocation.cpp
> cfe/trunk/lib/Frontend/InitPreprocessor.cpp
> cfe/trunk/test/OpenMP/driver.c
> cfe/trunk/test/OpenMP/predefined_macro.c
> 
> Modified: cfe/trunk/include/clang/Basic/LangOptions.def
> URL: http://llvm.org/viewvc/llvm-
> project/cfe/trunk/include/clang/Basic/LangOptions.def?rev=270838&r1=270
> 837&r2=270838&view=diff
> ==
> 
> --- cfe/trunk/include/clang/Basic/LangOptions.def (original)
> +++ cfe/trunk/include/clang/Basic/LangOptions.def Thu May 26 06:10:11
> 2016
> @@ -182,7 +182,7 @@ LANGOPT(NativeHalfType, 1, 0, "Nativ
>  LANGOPT(NativeHalfArgsAndReturns, 1, 0, "Native half args and returns")
>  LANGOPT(HalfArgsAndReturns, 1, 0, "half args and returns")
>  LANGOPT(CUDA  , 1, 0, "CUDA")
> -LANGOPT(OpenMP, 1, 0, "OpenMP support")
> +LANGOPT(OpenMP, 32, 0, "OpenMP support and version of OpenMP
> (31, 40 or 45)")
>  LANGOPT(OpenMPUseTLS  , 1, 0, "Use TLS for threadprivates or runtime
> calls")
>  LANGOPT(OpenMPIsDevice, 1, 0, "Generate code only for OpenMP target
> device")
> 
> 
> Modified: cfe/trunk/include/clang/Driver/Options.td
> URL: http://llvm.org/viewvc/llvm-
> project/cfe/trunk/include/clang/Driver/Options.td?rev=270838&r1=270837&
> r2=270838&view=diff
> ==
> 
> --- cfe/trunk/include/clang/Driver/Options.td (original)
> +++ cfe/trunk/include/clang/Driver/Options.td Thu May 26 06:10:11 2016
> @@ -1004,6 +1004,7 @@ def fobjc_sender_dependent_dispatch : Fl
>  def fomit_frame_pointer : Flag<["-"], "fomit-frame-pointer">,
> Group;
>  def fopenmp : Flag<["-"], "fopenmp">, Group, Flags<[CC1Option,
> NoArgumentUnused]>;
>  def fno_openmp : Flag<["-"], "fno-openmp">, Group,
> Flags<[NoArgumentUnused]>;
> +def fopenmp_version_EQ : Joined<["-"], "fopenmp-version=">,
> Group, Flags<[CC1Option, NoArgumentUnused]>;
>  def fopenmp_EQ : Joined<["-"], "fopenmp=">, Group;
>  def fopenmp_use_tls : Flag<["-"], "fopenmp-use-tls">, Group,
> Flags<[NoArgumentUnused]>;
>  def fnoopenmp_use_tls : Flag<["-"], "fnoopenmp-use-tls">,
> Group, Flags<[CC1Option, NoArgumentUnused]>;
> 
> Modified: cfe/trunk/lib/Driver/Tools.cpp
> URL: http://llvm.org/viewvc/llvm-
> project/cfe/trunk/lib/Driver/Tools.cpp?rev=270838&r1=270837&r2=270838&
> view=diff
> ==
> 
> --- cfe/trunk/lib/Driver/Tools.cpp (original)
> +++ cfe/trunk/lib/Driver/Tools.cpp Thu May 26 06:10:11 2016
> @@ -4862,7 +4862,8 @@ void Clang::ConstructJob(Compilation &C,
> 
>// Forward flags for OpenMP
>if (Args.hasFlag(options::OPT_fopenmp, options::OPT_fopenmp_EQ,
> -   options::OPT_fno_openmp, false))
> +   options::OPT_fno_openmp, false)) {
> +Args.AddAllArgs(CmdArgs, options::OPT_fopenmp_version_EQ);
>  switch (getOpenMPRuntime(getToolChain(), Args)) {
>  case OMPRT_OMP:
>  case OMPRT_IOMP5:
> @@ -4885,6 +4886,7 @@ void Clang::ConstructJob(Compilation &C,
>// semantic analysis, etc.
>break;
>  }
> +  }
> 
>const SanitizerArgs &Sanitize = getToolChain().getSanitizerArgs();
>Sanitize.addArgs(getToolChain(), Args, CmdArgs, InputType);
> 
> Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
> URL: http://llvm.org/viewvc/llvm-
> project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=270838&r1=270
> 837&r2=270838&view=diff
> ==
> 
> --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
> +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Thu May 26 06:10:11
> 2016
> @@ -1960,18 +1960,23 @@ static void ParseLangArgs(LangOptions &O
>Opts.OpenMPIsDevice =
>Opts.OpenMP && Args.has

Re: [PATCH] D20672: Don't pass -fms-compatibility-version flag during build

2016-05-26 Thread Hans Wennborg via cfe-commits
hans accepted this revision.
hans added a comment.
This revision is now accepted and ready to land.

lgtm if it works :-)


Repository:
  rL LLVM

http://reviews.llvm.org/D20672



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


Re: r270373 - [driver][mips] Support new versions of MIPS CodeScape toolchains

2016-05-26 Thread Ismail Donmez via cfe-commits
It does, thanks!

On Thu, May 26, 2016 at 3:35 PM, Simon Atanasyan  wrote:
> I hope r270842 fixes the problem.
>
> Thanks a lot for your help.
>
> On Thu, May 26, 2016 at 11:28 AM, Ismail Donmez  wrote:
>> Indeed the problematic option is -DCLANG_DEFAULT_CXX_STDLIB=libc++ ,
>> thanks Jonas!
>>
>> On Thu, May 26, 2016 at 11:19 AM, Hahnfeld, Jonas
>>  wrote:
>>> Hi,
>>>
>>> Have you also set CLANG_DEFAULT_CXX_STDLIB? Then you may need to add an
>>> '-stdlib=platform' to the test... (see r260662 and r263434)
>>>
>>> Cheers,
>>> Jonas
>>>
 -Original Message-
 From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf
 Of Ismail Donmez via cfe-commits
 Sent: Thursday, May 26, 2016 10:03 AM
 To: Simon Atanasyan
 Cc: cfe-commits
 Subject: Re: r270373 - [driver][mips] Support new versions of MIPS
 CodeScape toolchains

 Hi,

 I think this is because I enable libc++ by default with -
 DLLVM_ENABLE_LIBCXX=ON , so this tests need an explicit -stdlib=libstdc++
>
> --
> Simon Atanasyan
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2016-05-26 Thread Roger Ferrer Ibanez via cfe-commits
rogfer01 added a comment.

Firefox build has ended and exposes 62 diagnostics, 44 unique ocurrences and 10 
different diagnostics (shown below) in networking code.

  taking address of packed member 'address' of class or structure 
'sctp_state_cookie' may result in an unaligned pointer value
  taking address of packed member 'addr' of class or structure 
'sctp_ipv4addr_param' may result in an unaligned pointer value
  taking address of packed member 'addr' of class or structure 
'sctp_ipv6addr_param' may result in an unaligned pointer value
  taking address of packed member 'aph' of class or structure 
'sctp_asconf_addr_param' may result in an unaligned pointer value
  taking address of packed member 'cookie' of class or structure 
'sctp_cookie_echo_chunk' may result in an unaligned pointer value
  taking address of packed member 'init' of class or structure 
'sctp_init_chunk' may result in an unaligned pointer value
  taking address of packed member 'laddress' of class or structure 
'sctp_state_cookie' may result in an unaligned pointer value
  taking address of packed member 'ph' of class or structure 
'sctp_ipv4addr_param' may result in an unaligned pointer value
  taking address of packed member 'ph' of class or structure 
'sctp_ipv6addr_param' may result in an unaligned pointer value
  taking address of packed member 'time_entered' of class or structure 
'sctp_state_cookie' may result in an unaligned pointer value

which leads me to think that there might be cases where the field of a packed 
struct happens to be aligned for the type of the field itself. I'll add a check 
for this. I'll give it a spin.


http://reviews.llvm.org/D20561



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


Re: [PATCH] D15421: [Feature] Add a builtin for indexing into parameter packs

2016-05-26 Thread Louis Dionne via cfe-commits
ldionne updated this revision to Diff 58619.
ldionne added a comment.

Rebase the patch on top of the current `master`. The patch passes all of 
Clang's tests (`make check-clang`). I also removed the TODO comment about 
diagnostics, since that was answered by Richard Smith.


http://reviews.llvm.org/D15421

Files:
  include/clang/AST/ASTContext.h
  include/clang/AST/DeclTemplate.h
  include/clang/Basic/Builtins.h
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Serialization/ASTBitCodes.h
  lib/AST/ASTContext.cpp
  lib/AST/DeclTemplate.cpp
  lib/Lex/PPMacroExpansion.cpp
  lib/Sema/SemaLookup.cpp
  lib/Sema/SemaTemplate.cpp
  lib/Serialization/ASTReader.cpp
  lib/Serialization/ASTWriter.cpp
  test/PCH/type_pack_element.cpp
  test/SemaCXX/type_pack_element.cpp

Index: test/SemaCXX/type_pack_element.cpp
===
--- /dev/null
+++ test/SemaCXX/type_pack_element.cpp
@@ -0,0 +1,45 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
+
+static_assert(__has_builtin(__type_pack_element), "");
+
+using SizeT = decltype(sizeof(int));
+
+template 
+using TypePackElement = __type_pack_element;
+
+template 
+struct X;
+
+static_assert(__is_same(TypePackElement<0, X<0>>, X<0>), "");
+
+static_assert(__is_same(TypePackElement<0, X<0>, X<1>>, X<0>), "");
+static_assert(__is_same(TypePackElement<1, X<0>, X<1>>, X<1>), "");
+
+static_assert(__is_same(TypePackElement<0, X<0>, X<1>, X<2>>, X<0>), "");
+static_assert(__is_same(TypePackElement<1, X<0>, X<1>, X<2>>, X<1>), "");
+static_assert(__is_same(TypePackElement<2, X<0>, X<1>, X<2>>, X<2>), "");
+
+static_assert(__is_same(TypePackElement<0, X<0>, X<1>, X<2>, X<3>>, X<0>), "");
+static_assert(__is_same(TypePackElement<1, X<0>, X<1>, X<2>, X<3>>, X<1>), "");
+static_assert(__is_same(TypePackElement<2, X<0>, X<1>, X<2>, X<3>>, X<2>), "");
+static_assert(__is_same(TypePackElement<3, X<0>, X<1>, X<2>, X<3>>, X<3>), "");
+
+static_assert(__is_same(TypePackElement<0, X<0>, X<1>, X<2>, X<3>, X<4>>, X<0>), "");
+static_assert(__is_same(TypePackElement<1, X<0>, X<1>, X<2>, X<3>, X<4>>, X<1>), "");
+static_assert(__is_same(TypePackElement<2, X<0>, X<1>, X<2>, X<3>, X<4>>, X<2>), "");
+static_assert(__is_same(TypePackElement<3, X<0>, X<1>, X<2>, X<3>, X<4>>, X<3>), "");
+static_assert(__is_same(TypePackElement<4, X<0>, X<1>, X<2>, X<3>, X<4>>, X<4>), "");
+
+static_assert(__is_same(TypePackElement<0, X<0>, X<1>, X<2>, X<3>, X<4>, X<5>>, X<0>), "");
+static_assert(__is_same(TypePackElement<1, X<0>, X<1>, X<2>, X<3>, X<4>, X<5>>, X<1>), "");
+static_assert(__is_same(TypePackElement<2, X<0>, X<1>, X<2>, X<3>, X<4>, X<5>>, X<2>), "");
+static_assert(__is_same(TypePackElement<3, X<0>, X<1>, X<2>, X<3>, X<4>, X<5>>, X<3>), "");
+static_assert(__is_same(TypePackElement<4, X<0>, X<1>, X<2>, X<3>, X<4>, X<5>>, X<4>), "");
+static_assert(__is_same(TypePackElement<5, X<0>, X<1>, X<2>, X<3>, X<4>, X<5>>, X<5>), "");
+
+// Test __type_pack_element with more than 2 top-level template arguments.
+static_assert(__is_same(__type_pack_element<5, X<0>, X<1>, X<2>, X<3>, X<4>, X<5>>, X<5>), "");
+
+template 
+using ErrorTypePackElement1 = __type_pack_element; // expected-error{{may not be accessed at an out of bounds index}}
+using illformed1 = ErrorTypePackElement1<3, X<0>, X<1>>;  // expected-note{{in instantiation}}
Index: test/PCH/type_pack_element.cpp
===
--- /dev/null
+++ test/PCH/type_pack_element.cpp
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -std=c++14 -x c++-header %s -emit-pch -o %t.pch
+// RUN: %clang_cc1 -std=c++14 -x c++ /dev/null -include-pch %t.pch
+
+template 
+struct X { };
+
+using SizeT = decltype(sizeof(int));
+
+template 
+using TypePackElement = __type_pack_element;
+
+void fn1() {
+  X<0> x0 = TypePackElement<0, X<0>, X<1>, X<2>>{};
+  X<1> x1 = TypePackElement<1, X<0>, X<1>, X<2>>{};
+  X<2> x2 = TypePackElement<2, X<0>, X<1>, X<2>>{};
+}
Index: lib/Serialization/ASTWriter.cpp
===
--- lib/Serialization/ASTWriter.cpp
+++ lib/Serialization/ASTWriter.cpp
@@ -4191,6 +4191,8 @@
  PREDEF_DECL_CF_CONSTANT_STRING_ID);
   RegisterPredefDecl(Context.CFConstantStringTagDecl,
  PREDEF_DECL_CF_CONSTANT_STRING_TAG_ID);
+  RegisterPredefDecl(Context.TypePackElementDecl,
+ PREDEF_DECL_TYPE_PACK_ELEMENT_ID);
 
   // Build a record containing all of the tentative definitions in this file, in
   // TentativeDefinitions order.  Generally, this record will be empty for
Index: lib/Serialization/ASTReader.cpp
===
--- lib/Serialization/ASTReader.cpp
+++ lib/Serialization/ASTReader.cpp
@@ -6428,6 +6428,9 @@
 
   case PREDEF_DECL_CF_CONSTANT_STRING_TAG_ID:
 return Context.getCFConstantStringTagDecl();
+
+  case PREDEF_DECL_TYPE_PACK_ELEMENT_ID:
+return Context.getTypePackElementDec

Re: [PATCH] D20677: Make it possible to build a -fno-exceptions libc++abi variant.

2016-05-26 Thread Asiri Rathnayake via cfe-commits
rmaprath updated this revision to Diff 58620.

http://reviews.llvm.org/D20677

Files:
  CMakeLists.txt
  src/cxa_aux_runtime.cpp
  src/cxa_handlers.cpp
  src/cxa_new_delete.cpp
  src/cxa_personality.cpp
  test/CMakeLists.txt
  test/backtrace_test.pass.cpp
  test/catch_array_01.pass.cpp
  test/catch_array_02.pass.cpp
  test/catch_class_01.pass.cpp
  test/catch_class_02.pass.cpp
  test/catch_class_03.pass.cpp
  test/catch_class_04.pass.cpp
  test/catch_const_pointer_nullptr.pass.cpp
  test/catch_function_01.pass.cpp
  test/catch_function_02.pass.cpp
  test/catch_in_noexcept.pass.cpp
  test/catch_member_data_pointer_01.pass.cpp
  test/catch_member_function_pointer_01.pass.cpp
  test/catch_member_pointer_nullptr.pass.cpp
  test/catch_multi_level_pointer.pass.cpp
  test/catch_pointer_nullptr.pass.cpp
  test/catch_pointer_reference.pass.cpp
  test/catch_ptr.pass.cpp
  test/catch_ptr_02.pass.cpp
  test/incomplete_type.sh.cpp
  test/inherited_exception.pass.cpp
  test/libcxxabi/test/config.py
  test/lit.site.cfg.in
  test/test_aux_runtime.pass.cpp
  test/test_aux_runtime_op_array_new.pass.cpp
  test/test_guard.pass.cpp
  test/test_vector1.pass.cpp
  test/test_vector2.pass.cpp
  test/test_vector3.pass.cpp
  test/uncaught_exceptions.pass.cpp
  test/unwind_01.pass.cpp
  test/unwind_02.pass.cpp
  test/unwind_03.pass.cpp
  test/unwind_04.pass.cpp
  test/unwind_05.pass.cpp
  test/unwind_06.pass.cpp

Index: test/unwind_06.pass.cpp
===
--- test/unwind_06.pass.cpp
+++ test/unwind_06.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// UNSUPPORTED: libcxxabi-no-exceptions
+
 #include 
 #include 
 #include 
Index: test/unwind_05.pass.cpp
===
--- test/unwind_05.pass.cpp
+++ test/unwind_05.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// UNSUPPORTED: libcxxabi-no-exceptions
+
 #include 
 #include 
 #include 
Index: test/unwind_04.pass.cpp
===
--- test/unwind_04.pass.cpp
+++ test/unwind_04.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// UNSUPPORTED: libcxxabi-no-exceptions
+
 #include 
 #include 
 #include 
Index: test/unwind_03.pass.cpp
===
--- test/unwind_03.pass.cpp
+++ test/unwind_03.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// UNSUPPORTED: libcxxabi-no-exceptions
+
 #include 
 #include 
 #include 
Index: test/unwind_02.pass.cpp
===
--- test/unwind_02.pass.cpp
+++ test/unwind_02.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// UNSUPPORTED: libcxxabi-no-exceptions
+
 #include 
 
 struct A
Index: test/unwind_01.pass.cpp
===
--- test/unwind_01.pass.cpp
+++ test/unwind_01.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// UNSUPPORTED: libcxxabi-no-exceptions
+
 #include 
 
 struct A
Index: test/uncaught_exceptions.pass.cpp
===
--- test/uncaught_exceptions.pass.cpp
+++ test/uncaught_exceptions.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// UNSUPPORTED: libcxxabi-no-exceptions
+
 #include 
 #include 
 #include 
Index: test/test_vector3.pass.cpp
===
--- test/test_vector3.pass.cpp
+++ test/test_vector3.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// UNSUPPORTED: libcxxabi-no-exceptions
+
 #include "cxxabi.h"
 
 #include 
Index: test/test_vector2.pass.cpp
===
--- test/test_vector2.pass.cpp
+++ test/test_vector2.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// UNSUPPORTED: libcxxabi-no-exceptions
+
 #include "cxxabi.h"
 
 #include 
Index: test/test_vector1.pass.cpp
===
--- test/test_vector1.pass.cpp
+++ test/test_vector1.pass.cpp
@@ -7,6 +7,8 @@
 //
 //===--===//
 
+// UNSUPPORTED: libcxxabi-no-exceptions
+
 #include "cxxabi.h"
 
 #include 
Index: test/test_guard.pass.cpp
===
--- test/test_guard.pass.cpp
+++ test/test_guard.pass.cpp
@@ -41,6 +41,7 @@
 // When initialization 

RE: [PATCH] D20681: Add target-specific pre-linking passes to Clang

2016-05-26 Thread Liu, Yaxun (Sam) via cfe-commits
+ Brian

-Original Message-
From: Tom Stellard [mailto:thomas.stell...@amd.com] 
Sent: Thursday, May 26, 2016 11:11 AM
To: Liu, Yaxun (Sam) ; rich...@metafoo.co.uk; 
anastasia.stul...@arm.com
Cc: Stellard, Thomas ; cfe-commits@lists.llvm.org
Subject: Re: [PATCH] D20681: Add target-specific pre-linking passes to Clang

tstellarAMD added a comment.

Can you give some examples of what pre-link passes may be required?


http://reviews.llvm.org/D20681



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


Re: [PATCH] D20677: Make it possible to build a -fno-exceptions libc++abi variant.

2016-05-26 Thread Asiri Rathnayake via cfe-commits
rmaprath marked 2 inline comments as done.


Comment at: src/cxa_aux_runtime.cpp:19-20
@@ -18,3 +18,4 @@
 extern "C" {
 _LIBCXXABI_FUNC_VIS LIBCXXABI_NORETURN void __cxa_bad_cast(void) {
+#ifndef _LIBCXXABI_NO_EXCEPTIONS
   throw std::bad_cast();

I'm not very familiar with how RTTI works, I was simply getting rid of the 
`throw` statements which get in the way of compiling with `-fno-exceptions`.

So, I presume these `__cxa_bad_xxx` calls are inserted by the compiler?

The tests `dynamic_cast_xxx` all seem to pass, which I found a bit weird 
because I would've expected some of those to fail because of the 
`std::terminate()`. Or are they not related to RTTI?


Comment at: src/cxa_new_delete.cpp:85-86
@@ -79,2 +84,4 @@
+#endif
 p = ::operator new(size);
+#ifndef _LIBCXXABI_NO_EXCEPTIONS
 }

I agree. I've update it to be inline with `new.cpp` from libcxx.

At least the users will have some method of recovery if we return null, calling 
`std::terminate()` would be a bit rude.


http://reviews.llvm.org/D20677



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


Re: [PATCH] D20672: Don't pass -fms-compatibility-version flag during build

2016-05-26 Thread İsmail Dönmez via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL270860: Since some time clang itself figures out the default 
for ms-compatibility… (authored by ismail).

Changed prior to commit:
  http://reviews.llvm.org/D20672?vs=58586&id=58623#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20672

Files:
  llvm/trunk/cmake/modules/HandleLLVMOptions.cmake

Index: llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
===
--- llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
+++ llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
@@ -353,19 +353,6 @@
   append("/Zc:rvalueCast" CMAKE_CXX_FLAGS)
 
   if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
-# Find and run MSVC (not clang-cl) and get its version. This will tell
-# clang-cl what version of MSVC to pretend to be so that the STL works.
-execute_process(COMMAND "$ENV{VSINSTALLDIR}/VC/bin/cl.exe"
-  OUTPUT_QUIET
-  ERROR_VARIABLE MSVC_COMPAT_VERSION
-  )
-string(REGEX REPLACE "^.*Compiler Version ([0-9.]+) for .*$" "\\1"
-  MSVC_COMPAT_VERSION "${MSVC_COMPAT_VERSION}")
-append("-fms-compatibility-version=${MSVC_COMPAT_VERSION}"
-  CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
-  endif()
-
-  if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
 # clang-cl and cl by default produce non-deterministic binaries because
 # link.exe /incremental requires a timestamp in the .obj file.  clang-cl
 # has the flag /Brepro to force deterministic binaries. We want to pass 
that


Index: llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
===
--- llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
+++ llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
@@ -353,19 +353,6 @@
   append("/Zc:rvalueCast" CMAKE_CXX_FLAGS)
 
   if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
-# Find and run MSVC (not clang-cl) and get its version. This will tell
-# clang-cl what version of MSVC to pretend to be so that the STL works.
-execute_process(COMMAND "$ENV{VSINSTALLDIR}/VC/bin/cl.exe"
-  OUTPUT_QUIET
-  ERROR_VARIABLE MSVC_COMPAT_VERSION
-  )
-string(REGEX REPLACE "^.*Compiler Version ([0-9.]+) for .*$" "\\1"
-  MSVC_COMPAT_VERSION "${MSVC_COMPAT_VERSION}")
-append("-fms-compatibility-version=${MSVC_COMPAT_VERSION}"
-  CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
-  endif()
-
-  if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
 # clang-cl and cl by default produce non-deterministic binaries because
 # link.exe /incremental requires a timestamp in the .obj file.  clang-cl
 # has the flag /Brepro to force deterministic binaries. We want to pass that
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D20684: [X86][SSE] Replace VPMOVSX and (V)PMOVZX integer extension intrinsics with generic IR (clang)

2016-05-26 Thread Simon Pilgrim via cfe-commits
RKSimon created this revision.
RKSimon added reviewers: mkuper, craig.topper, spatel, andreadb.
RKSimon added a subscriber: cfe-commits.
RKSimon set the repository for this revision to rL LLVM.

The VPMOVSX and (V)PMOVZX sign/zero extension intrinsics can be safely 
represented as generic __builtin_convertvector calls instead of x86 intrinsics.

This patch removes the clang builtins and their use in the sse2/avx headers - a 
companion patch will remove/auto-upgrade the llvm intrinsics.

Note: We already did this for SSE41 PMOVSX sometime ago.

Repository:
  rL LLVM

http://reviews.llvm.org/D20684

Files:
  include/clang/Basic/BuiltinsX86.def
  lib/Headers/avx2intrin.h
  lib/Headers/smmintrin.h
  test/CodeGen/avx2-builtins.c
  test/CodeGen/builtins-x86.c
  test/CodeGen/sse41-builtins.c

Index: test/CodeGen/sse41-builtins.c
===
--- test/CodeGen/sse41-builtins.c
+++ test/CodeGen/sse41-builtins.c
@@ -119,37 +119,43 @@
 
 __m128i test_mm_cvtepu8_epi16(__m128i a) {
   // CHECK-LABEL: test_mm_cvtepu8_epi16
-  // CHECK: call <8 x i16> @llvm.x86.sse41.pmovzxbw(<16 x i8> {{.*}})
+  // CHECK: shufflevector <16 x i8> {{.*}}, <16 x i8> {{.*}}, <8 x i32> 
+  // CHECK: zext <8 x i8> {{.*}} to <8 x i16>
   return _mm_cvtepu8_epi16(a);
 }
 
 __m128i test_mm_cvtepu8_epi32(__m128i a) {
   // CHECK-LABEL: test_mm_cvtepu8_epi32
-  // CHECK: call <4 x i32> @llvm.x86.sse41.pmovzxbd(<16 x i8> {{.*}})
+  // CHECK: shufflevector <16 x i8> {{.*}}, <16 x i8> {{.*}}, <4 x i32> 
+  // CHECK: zext <4 x i8> {{.*}} to <4 x i32>
   return _mm_cvtepu8_epi32(a);
 }
 
 __m128i test_mm_cvtepu8_epi64(__m128i a) {
   // CHECK-LABEL: test_mm_cvtepu8_epi64
-  // CHECK: call <2 x i64> @llvm.x86.sse41.pmovzxbq(<16 x i8> {{.*}})
+  // CHECK: shufflevector <16 x i8> {{.*}}, <16 x i8> {{.*}}, <2 x i32> 
+  // CHECK: zext <2 x i8> {{.*}} to <2 x i64>
   return _mm_cvtepu8_epi64(a);
 }
 
 __m128i test_mm_cvtepu16_epi32(__m128i a) {
   // CHECK-LABEL: test_mm_cvtepu16_epi32
-  // CHECK: call <4 x i32> @llvm.x86.sse41.pmovzxwd(<8 x i16> {{.*}})
+  // CHECK: shufflevector <8 x i16> {{.*}}, <8 x i16> {{.*}}, <4 x i32> 
+  // CHECK: zext <4 x i16> {{.*}} to <4 x i32>
   return _mm_cvtepu16_epi32(a);
 }
 
 __m128i test_mm_cvtepu16_epi64(__m128i a) {
   // CHECK-LABEL: test_mm_cvtepu16_epi64
-  // CHECK: call <2 x i64> @llvm.x86.sse41.pmovzxwq(<8 x i16> {{.*}})
+  // CHECK: shufflevector <8 x i16> {{.*}}, <8 x i16> {{.*}}, <2 x i32> 
+  // CHECK: zext <2 x i16> {{.*}} to <2 x i64>
   return _mm_cvtepu16_epi64(a);
 }
 
 __m128i test_mm_cvtepu32_epi64(__m128i a) {
   // CHECK-LABEL: test_mm_cvtepu32_epi64
-  // CHECK: call <2 x i64> @llvm.x86.sse41.pmovzxdq(<4 x i32> {{.*}})
+  // CHECK: shufflevector <4 x i32> {{.*}}, <4 x i32> {{.*}}, <2 x i32> 
+  // CHECK: zext <2 x i32> {{.*}} to <2 x i64>
   return _mm_cvtepu32_epi64(a);
 }
 
Index: test/CodeGen/builtins-x86.c
===
--- test/CodeGen/builtins-x86.c
+++ test/CodeGen/builtins-x86.c
@@ -387,12 +387,6 @@
   tmp_V4i = __builtin_ia32_pminsd128(tmp_V4i, tmp_V4i);
   tmp_V4i = __builtin_ia32_pminud128(tmp_V4i, tmp_V4i);
   tmp_V8s = __builtin_ia32_pminuw128(tmp_V8s, tmp_V8s);
-  tmp_V4i = __builtin_ia32_pmovzxbd128(tmp_V16c);
-  tmp_V2LLi = __builtin_ia32_pmovzxbq128(tmp_V16c);
-  tmp_V8s = __builtin_ia32_pmovzxbw128(tmp_V16c);
-  tmp_V2LLi = __builtin_ia32_pmovzxdq128(tmp_V4i);
-  tmp_V4i = __builtin_ia32_pmovzxwd128(tmp_V8s);
-  tmp_V2LLi = __builtin_ia32_pmovzxwq128(tmp_V8s);
   tmp_V2LLi = __builtin_ia32_pmuldq128(tmp_V4i, tmp_V4i);
   tmp_V4i = __builtin_ia32_pmulld128(tmp_V4i, tmp_V4i);
   tmp_V4f = __builtin_ia32_roundps(tmp_V4f, imm_i_0_16);
Index: test/CodeGen/avx2-builtins.c
===
--- test/CodeGen/avx2-builtins.c
+++ test/CodeGen/avx2-builtins.c
@@ -292,73 +292,79 @@
 
 __m256i test_mm256_cvtepi8_epi16(__m128i a) {
   // CHECK-LABEL: test_mm256_cvtepi8_epi16
-  // CHECK: call <16 x i16> @llvm.x86.avx2.pmovsxbw(<16 x i8> %{{.*}})
+  // CHECK: sext <16 x i8> %{{.*}} to <16 x i16>
   return _mm256_cvtepi8_epi16(a);
 }
 
 __m256i test_mm256_cvtepi8_epi32(__m128i a) {
   // CHECK-LABEL: test_mm256_cvtepi8_epi32
-  // CHECK: call <8 x i32> @llvm.x86.avx2.pmovsxbd(<16 x i8> %{{.*}})
+  // CHECK: shufflevector <16 x i8> %{{.*}}, <16 x i8> %{{.*}}, <8 x i32> 
+  // CHECK: sext <8 x i8> %{{.*}} to <8 x i32>
   return _mm256_cvtepi8_epi32(a);
 }
 
 __m256i test_mm256_cvtepi8_epi64(__m128i a) {
   // CHECK-LABEL: test_mm256_cvtepi8_epi64
-  // CHECK: call <4 x i64> @llvm.x86.avx2.pmovsxbq(<16 x i8> %{{.*}})
+  // CHECK: shufflevector <16 x i8> %{{.*}}, <16 x i8> %{{.*}}, <4 x i32> 
+  // CHECK: sext <4 x i8> %{{.*}} to <4 x i64>
   return _mm256_cvtepi8_epi64(a);
 }
 
 __m256i test_mm256_cvtepi16_epi32(__m128i a) {
   // CHECK-LABEL: test_mm256_cvtepi16_epi32
-  // CHECK: call <8 x i32> @llvm.x86.avx2.pmovsxwd(<8 x i16> %{{.*}})
+  /

Re: [PATCH] D20677: Make it possible to build a -fno-exceptions libc++abi variant.

2016-05-26 Thread Ben Craig via cfe-commits
bcraig added inline comments.


Comment at: src/cxa_aux_runtime.cpp:19-24
@@ -18,4 +18,8 @@
 extern "C" {
 _LIBCXXABI_FUNC_VIS LIBCXXABI_NORETURN void __cxa_bad_cast(void) {
+#ifndef _LIBCXXABI_NO_EXCEPTIONS
   throw std::bad_cast();
+#else
+  std::terminate();
+#endif
 }

bcraig wrote:
> So you're turning off exceptions, but leaving RTTI?  You might want to keep 
> some of the RTTI tests around too if that's the case.
_cxa_bad_cast should be inserted by the compiler.  It is called when a 
dynamic_cast to a reference type fails.
_cxa_bad_typeid should be inserted by the compiler.  It is called when typeid 
is used on a null pointer.

_cxa_throw_bad_array_new_length should probably stay put.  The most common 
reason for that to get hit is if sizeof(obj) * number_of_elts > SIZE_T_MAX.


http://reviews.llvm.org/D20677



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


[PATCH] D20687: Update hasDynamicExceptionSpec to use functionType instead of functionDecl.

2016-05-26 Thread don hinton via cfe-commits
hintonda created this revision.
hintonda added a reviewer: aaron.ballman.
hintonda added a subscriber: cfe-commits.
Herald added a subscriber: klimek.

Update hasDynamicExceptionSpec to use functionType instead of
functionDecl.

http://reviews.llvm.org/D20687

Files:
  docs/LibASTMatchersReference.html
  include/clang/ASTMatchers/ASTMatchers.h
  unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp

Index: unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
===
--- unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
+++ unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
@@ -1383,19 +1383,19 @@
 }
 
 TEST(hasDynamicExceptionSpec, MatchesDynamicExceptionSpecifications) {
-  EXPECT_TRUE(notMatches("void f();", 
functionDecl(hasDynamicExceptionSpec(;
+  EXPECT_TRUE(notMatches("void f();", 
functionType(hasDynamicExceptionSpec(;
   EXPECT_TRUE(notMatches("void g() noexcept;",
- functionDecl(hasDynamicExceptionSpec(;
+ functionType(hasDynamicExceptionSpec(;
   EXPECT_TRUE(notMatches("void h() noexcept(true);",
- functionDecl(hasDynamicExceptionSpec(;
+ functionType(hasDynamicExceptionSpec(;
   EXPECT_TRUE(notMatches("void i() noexcept(false);",
- functionDecl(hasDynamicExceptionSpec(;
+ functionType(hasDynamicExceptionSpec(;
   EXPECT_TRUE(
-  matches("void j() throw();", functionDecl(hasDynamicExceptionSpec(;
+  matches("void j() throw();", functionType(hasDynamicExceptionSpec(;
   EXPECT_TRUE(
-  matches("void k() throw(int);", 
functionDecl(hasDynamicExceptionSpec(;
+  matches("void k() throw(int);", 
functionType(hasDynamicExceptionSpec(;
   EXPECT_TRUE(
-  matches("void l() throw(...);", 
functionDecl(hasDynamicExceptionSpec(;
+  matches("void l() throw(...);", 
functionType(hasDynamicExceptionSpec(;
 }
 
 TEST(HasObjectExpression, DoesNotMatchMember) {
Index: include/clang/ASTMatchers/ASTMatchers.h
===
--- include/clang/ASTMatchers/ASTMatchers.h
+++ include/clang/ASTMatchers/ASTMatchers.h
@@ -3245,10 +3245,10 @@
 ///   void k() throw(int);
 ///   void l() throw(...);
 /// \endcode
-/// functionDecl(hasDynamicExceptionSpec())
+/// functionType(hasDynamicExceptionSpec())
 ///   matches the declarations of j, k, and l, but not f, g, h, or i.
-AST_MATCHER(FunctionDecl, hasDynamicExceptionSpec) {
-  if (const auto *FnTy = Node.getType()->getAs())
+AST_MATCHER(FunctionType, hasDynamicExceptionSpec) {
+  if (const auto *FnTy = dyn_cast(&Node))
 return FnTy->hasDynamicExceptionSpec();
   return false;
 }
Index: docs/LibASTMatchersReference.html
===
--- docs/LibASTMatchersReference.html
+++ docs/LibASTMatchersReference.html
@@ -2403,22 +2403,6 @@
 
 
 
-MatcherFunctionDecl>hasDynamicExceptionSpec
-Matches 
functions that have a dynamic exception specification.
-
-Given:
-  void f();
-  void g() noexcept;
-  void h() noexcept(true);
-  void i() noexcept(false);
-  void j() throw();
-  void k() throw(int);
-  void l() throw(...);
-functionDecl(hasDynamicExceptionSpec())
-  matches the declarations of j, k, and l, but not f, g, h, or i.
-
-
-
 MatcherFunctionDecl>hasOverloadedOperatorNameStringRef
 Name
 Matches 
overloaded operator names.
 
@@ -2616,6 +2600,22 @@
 
 
 
+MatcherFunctionType>hasDynamicExceptionSpec
+Matches 
functions that have a dynamic exception specification.
+
+Given:
+  void f();
+  void g() noexcept;
+  void h() noexcept(true);
+  void i() noexcept(false);
+  void j() throw();
+  void k() throw(int);
+  void l() throw(...);
+functionType(hasDynamicExceptionSpec())
+  matches the declarations of j, k, and l, but not f, g, h, or i.
+
+
+
 MatcherIntegerLiteral>equalsValueT  Value
 Matches literals that are 
equal to the given value.
 


Index: unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
===
--- unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
+++ unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
@@ -1383,19 +1383,19 @@
 }
 
 TEST(hasDynamicExceptionSpec, MatchesDynamicExceptionSpecifications) {
-  EXPECT_TRUE(notMatches("void f();", functionDecl(hasDynamicExceptionSpec(;
+  EXPECT_TRUE(notMatches("void f();", functionType(hasDynamicExceptionSpec(;
   EXPECT_TRUE(notMatches("void g() noexcept;",
- functionDecl(hasDynamicExceptionSpec(;
+ functionType(hasDynamicExceptionSpec(;
   EXPECT_TRUE(notMatche

Re: [PATCH] D20677: Make it possible to build a -fno-exceptions libc++abi variant.

2016-05-26 Thread Asiri Rathnayake via cfe-commits
rmaprath marked an inline comment as done.


Comment at: src/cxa_aux_runtime.cpp:19-25
@@ -18,5 +18,9 @@
 extern "C" {
 _LIBCXXABI_FUNC_VIS LIBCXXABI_NORETURN void __cxa_bad_cast(void) {
+#ifndef _LIBCXXABI_NO_EXCEPTIONS
   throw std::bad_cast();
+#else
+  std::terminate();
+#endif
 }
 

rmaprath wrote:
> I'm not very familiar with how RTTI works, I was simply getting rid of the 
> `throw` statements which get in the way of compiling with `-fno-exceptions`.
> 
> So, I presume these `__cxa_bad_xxx` calls are inserted by the compiler?
> 
> The tests `dynamic_cast_xxx` all seem to pass, which I found a bit weird 
> because I would've expected some of those to fail because of the 
> `std::terminate()`. Or are they not related to RTTI?
Thanks. I will try to get clang to generate these (btw, do you have a reference 
for those RTTI functions? I couldn't find much on the interwebs.

I suppose leaving these functions (which call `std::terminate()`) in the 
-fno-exceptions variant is not a problem?


http://reviews.llvm.org/D20677



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


Re: [PATCH] D20677: Make it possible to build a -fno-exceptions libc++abi variant.

2016-05-26 Thread Jonathan Roelofs via cfe-commits
jroelofs added a comment.

This is the canonical reference for the Itanium ABI: 
https://mentorembedded.github.io/cxx-abi/abi.html


http://reviews.llvm.org/D20677



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


r270868 - [OpenMP] Adjust map type bits according to latest spec and use zero size array sections for pointers.

2016-05-26 Thread Samuel Antao via cfe-commits
Author: sfantao
Date: Thu May 26 11:48:10 2016
New Revision: 270868

URL: http://llvm.org/viewvc/llvm-project?rev=270868&view=rev
Log:
[OpenMP] Adjust map type bits according to latest spec and use zero size array 
sections for pointers.

Summary: This patch changes the bits used to specify the map types according to 
the latest version of the libomptarget document and add the support for zero 
size array section when pointers are being implicitly mapped. This completes 
the missing new 4.5 map semantics.

Reviewers: hfinkel, carlo.bertolli, arpith-jacob, kkwli0, ABataev

Subscribers: caomhin, cfe-commits

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

Modified:
cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
cfe/trunk/test/OpenMP/target_codegen.cpp
cfe/trunk/test/OpenMP/target_codegen_registration.cpp
cfe/trunk/test/OpenMP/target_data_codegen.cpp
cfe/trunk/test/OpenMP/target_enter_data_codegen.cpp
cfe/trunk/test/OpenMP/target_exit_data_codegen.cpp
cfe/trunk/test/OpenMP/target_firstprivate_codegen.cpp
cfe/trunk/test/OpenMP/target_map_codegen.cpp

Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp?rev=270868&r1=270867&r2=270868&view=diff
==
--- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp Thu May 26 11:48:10 2016
@@ -4909,8 +4909,6 @@ public:
   /// \brief Values for bit flags used to specify the mapping type for
   /// offloading.
   enum OpenMPOffloadMappingFlags {
-/// \brief Only allocate memory on the device,
-OMP_MAP_ALLOC = 0x00,
 /// \brief Allocate memory on the device and move data from host to device.
 OMP_MAP_TO = 0x01,
 /// \brief Allocate memory on the device and move data from device to host.
@@ -4918,19 +4916,19 @@ public:
 /// \brief Always perform the requested mapping action on the element, even
 /// if it was already mapped before.
 OMP_MAP_ALWAYS = 0x04,
-/// \brief Decrement the reference count associated with the element 
without
-/// executing any other action.
-OMP_MAP_RELEASE = 0x08,
 /// \brief Delete the element from the device environment, ignoring the
 /// current reference count associated with the element.
-OMP_MAP_DELETE = 0x10,
-/// \brief The element passed to the device is a pointer.
-OMP_MAP_PTR = 0x20,
-/// \brief Signal the element as extra, i.e. is not argument to the target
-/// region kernel.
-OMP_MAP_EXTRA = 0x40,
+OMP_MAP_DELETE = 0x08,
+/// \brief The element being mapped is a pointer, therefore the pointee
+/// should be mapped as well.
+OMP_MAP_IS_PTR = 0x10,
+/// \brief This flags signals that an argument is the first one relating to
+/// a map/private clause expression. For some cases a single
+/// map/privatization results in multiple arguments passed to the runtime
+/// library.
+OMP_MAP_FIRST_REF = 0x20,
 /// \brief Pass the element to the device by value.
-OMP_MAP_BYCOPY = 0x80,
+OMP_MAP_PRIVATE_VAL = 0x100,
   };
 
   typedef SmallVector MapValuesArrayTy;
@@ -4987,14 +4985,19 @@ private:
 
   /// \brief Return the corresponding bits for a given map clause modifier. Add
   /// a flag marking the map as a pointer if requested. Add a flag marking the
-  /// map as extra, meaning is not an argument of the kernel.
+  /// map as the first one of a series of maps that relate to the same map
+  /// expression.
   unsigned getMapTypeBits(OpenMPMapClauseKind MapType,
   OpenMPMapClauseKind MapTypeModifier, bool AddPtrFlag,
-  bool AddExtraFlag) const {
+  bool AddIsFirstFlag) const {
 unsigned Bits = 0u;
 switch (MapType) {
 case OMPC_MAP_alloc:
-  Bits = OMP_MAP_ALLOC;
+case OMPC_MAP_release:
+  // alloc and release is the default behavior in the runtime library,  
i.e.
+  // if we don't pass any bits alloc/release that is what the runtime is
+  // going to do. Therefore, we don't need to signal anything for these two
+  // type modifiers.
   break;
 case OMPC_MAP_to:
   Bits = OMP_MAP_TO;
@@ -5008,17 +5011,14 @@ private:
 case OMPC_MAP_delete:
   Bits = OMP_MAP_DELETE;
   break;
-case OMPC_MAP_release:
-  Bits = OMP_MAP_RELEASE;
-  break;
 default:
   llvm_unreachable("Unexpected map type!");
   break;
 }
 if (AddPtrFlag)
-  Bits |= OMP_MAP_PTR;
-if (AddExtraFlag)
-  Bits |= OMP_MAP_EXTRA;
+  Bits |= OMP_MAP_IS_PTR;
+if (AddIsFirstFlag)
+  Bits |= OMP_MAP_FIRST_REF;
 if (MapTypeModifier == OMPC_MAP_always)
   Bits |= OMP_MAP_ALWAYS;
 return Bits;
@@ -5270,13 +5270,13 @@ private:
 
 Pointers.push_back(LB);
 Sizes.push_back(Size);
-// We need to add a pointer flag for each map t

Re: [PATCH] D20677: Make it possible to build a -fno-exceptions libc++abi variant.

2016-05-26 Thread Asiri Rathnayake via cfe-commits
rmaprath added a comment.

In http://reviews.llvm.org/D20677#441061, @jroelofs wrote:

> This is the canonical reference for the Itanium ABI: 
> https://mentorembedded.github.io/cxx-abi/abi.html


I was indeed looking at this, but couldn't find those exact function signatures 
(or something that looks like it). Perhaps it's covered there as a more general 
concept. I'll have a read.

Thanks!

/ Asiri


http://reviews.llvm.org/D20677



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


r270870 - [OpenMP] Add support for the 'private pointer' flag to signal variables captured in target regions and used in first-private clauses.

2016-05-26 Thread Samuel Antao via cfe-commits
Author: sfantao
Date: Thu May 26 11:53:38 2016
New Revision: 270870

URL: http://llvm.org/viewvc/llvm-project?rev=270870&view=rev
Log:
[OpenMP] Add support for the 'private pointer' flag to signal variables 
captured in target regions and used in first-private clauses.

Summary: If a variable is implicitly mapped (doesn't show in a map clause), the 
runtime library has to be informed if the corresponding capture shows up in 
first-private clause, so that the storage previously allocated in the device is 
used. This patch adds the support for that.

Reviewers: hfinkel, carlo.bertolli, arpith-jacob, kkwli0, ABataev

Subscribers: caomhin, cfe-commits

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

Modified:
cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
cfe/trunk/test/OpenMP/target_firstprivate_codegen.cpp
cfe/trunk/test/OpenMP/target_map_codegen.cpp

Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp?rev=270870&r1=270869&r2=270870&view=diff
==
--- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp Thu May 26 11:53:38 2016
@@ -4927,6 +4927,9 @@ public:
 /// map/privatization results in multiple arguments passed to the runtime
 /// library.
 OMP_MAP_FIRST_REF = 0x20,
+/// \brief This flag signals that the reference being passed is a pointer 
to
+/// private data.
+OMP_MAP_PRIVATE_PTR = 0x80,
 /// \brief Pass the element to the device by value.
 OMP_MAP_PRIVATE_VAL = 0x100,
   };
@@ -4941,6 +4944,9 @@ private:
   /// \brief Function the directive is being generated for.
   CodeGenFunction &CGF;
 
+  /// \brief Set of all first private variables in the current directive.
+  llvm::SmallPtrSet FirstPrivateDecls;
+
   llvm::Value *getExprTypeSize(const Expr *E) const {
 auto ExprTy = E->getType().getCanonicalType();
 
@@ -5293,9 +5299,33 @@ private:
 }
   }
 
+  /// \brief Return the adjusted map modifiers if the declaration a capture
+  /// refers to appears in a first-private clause. This is expected to be used
+  /// only with directives that start with 'target'.
+  unsigned adjustMapModifiersForPrivateClauses(const CapturedStmt::Capture 
&Cap,
+   unsigned CurrentModifiers) {
+assert(Cap.capturesVariable() && "Expected capture by reference only!");
+
+// A first private variable captured by reference will use only the
+// 'private ptr' and 'map to' flag. Return the right flags if the captured
+// declaration is known as first-private in this handler.
+if (FirstPrivateDecls.count(Cap.getCapturedVar()))
+  return MappableExprsHandler::OMP_MAP_PRIVATE_PTR |
+ MappableExprsHandler::OMP_MAP_TO;
+
+// We didn't modify anything.
+return CurrentModifiers;
+  }
+
 public:
   MappableExprsHandler(const OMPExecutableDirective &Dir, CodeGenFunction &CGF)
-  : Directive(Dir), CGF(CGF) {}
+  : Directive(Dir), CGF(CGF) {
+// Extract firstprivate clause information.
+for (const auto *C : Dir.getClausesOfKind())
+  for (const auto *D : C->varlists())
+FirstPrivateDecls.insert(
+
cast(cast(D)->getDecl())->getCanonicalDecl());
+  }
 
   /// \brief Generate all the base pointers, section pointers, sizes and map
   /// types for the extracted mappable expressions.
@@ -5377,6 +5407,86 @@ public:
 
 return;
   }
+
+  /// \brief Generate the default map information for a given capture \a CI,
+  /// record field declaration \a RI and captured value \a CV.
+  void generateDefaultMapInfo(
+  const CapturedStmt::Capture &CI, const FieldDecl &RI, llvm::Value *CV,
+  MappableExprsHandler::MapValuesArrayTy &CurBasePointers,
+  MappableExprsHandler::MapValuesArrayTy &CurPointers,
+  MappableExprsHandler::MapValuesArrayTy &CurSizes,
+  MappableExprsHandler::MapFlagsArrayTy &CurMapTypes) {
+auto &Ctx = CGF.getContext();
+
+// Do the default mapping.
+if (CI.capturesThis()) {
+  CurBasePointers.push_back(CV);
+  CurPointers.push_back(CV);
+  const PointerType *PtrTy = cast(RI.getType().getTypePtr());
+  CurSizes.push_back(CGF.getTypeSize(PtrTy->getPointeeType()));
+  // Default map type.
+  CurMapTypes.push_back(MappableExprsHandler::OMP_MAP_TO |
+MappableExprsHandler::OMP_MAP_FROM);
+} else if (CI.capturesVariableByCopy()) {
+  if (!RI.getType()->isAnyPointerType()) {
+// If the field is not a pointer, we need to save the actual value
+// and load it as a void pointer.
+CurMapTypes.push_back(MappableExprsHandler::OMP_MAP_PRIVATE_VAL);
+auto DstAddr = CGF.CreateMemTemp(Ctx.getUIntPtrType(),
+ Twine(CI.getCapturedVar()->getName()) 
+
+ ".casted");
+ 

Re: [PATCH] D20660: Remove `auto_ptr` in C++17.

2016-05-26 Thread David Blaikie via cfe-commits
NO_REMOVE seems like a strange way of saying it - is there existing
precedent for that naming/description? (rather than something like
_LIBCPP_PROVIDE_AUTOPTR ?

As for tests - XFAILing seems a bit general when there's really not much
value in running any of the tests anyway. REQUIRES, perhaps? (that does
bring the issue I assume Eric is alluding to forward a bit (I assume what
he's alluding to is that when we have c++2x then we'd have to say XFAIL
c++1z c++2x and so on - switching it around we /already/ have the problem
that we'd want the auto_ptr tests to REQUIRE c++11, c++14 or whatever)) &
maybe having an explicit test or two for the negative case (I would worry
that XFAIL would be too vague "this should fail somehow... "). But maybe
that's all unnecessary paranoia.

- Dave

On Wed, May 25, 2016 at 9:28 PM, Marshall Clow via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> mclow.lists created this revision.
> mclow.lists added a reviewer: EricWF.
> mclow.lists added a subscriber: cfe-commits.
>
> [[ http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4190 | N4190
> ]] removed `auto_ptr` from C++1z. (and other stuff)
>
> Wrap all the auto_ptr bits in an #ifdef so they disappear when compiling
> with `-std=c++1z` or later.
>
> Introduce a new configuration option, `_LIBCPP_NO_REMOVE_AUTOPTR` which
> allows user code to continue using `auto_ptr` in C++1z mode if desired.
>
> Add a test for `_LIBCPP_NO_REMOVE_AUTOPTR`, and mark all the rest of the
> `auto_ptr` tests to XFAIL for c++1z
>
> http://reviews.llvm.org/D20660
>
> Files:
>   include/memory
>   test/libcxx/depr/depr.auto.ptr/auto.ptr/auto_ptr.cxx1z.pass.cpp
>   test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/assignment.pass.cpp
>   test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert.pass.cpp
>
> test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert_assignment.pass.cpp
>   test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/copy.pass.cpp
>   test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/pointer.pass.cpp
>
> test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/assign_from_auto_ptr_ref.pass.cpp
>
> test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_from_auto_ptr_ref.pass.cpp
>
> test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_to_auto_ptr.pass.cpp
>
> test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_to_auto_ptr_ref.pass.cpp
>   test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/arrow.pass.cpp
>   test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/deref.pass.cpp
>   test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/release.pass.cpp
>   test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/reset.pass.cpp
>   test/std/depr/depr.auto.ptr/auto.ptr/element_type.pass.cpp
>
>
> ___
> 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


r270878 - [OpenMP] Parsing and sema support for target update directive

2016-05-26 Thread Samuel Antao via cfe-commits
Author: sfantao
Date: Thu May 26 12:30:50 2016
New Revision: 270878

URL: http://llvm.org/viewvc/llvm-project?rev=270878&view=rev
Log:
[OpenMP] Parsing and sema support for target update directive

Summary:
This patch is to add parsing and sema support for `target update` directive. 
Support for the `to` and `from` clauses will be added by a different patch.  
This patch also adds support for other clauses that are already implemented 
upstream and apply to `target update`, e.g. `device` and `if`.

This patch is based on the original post by Kelvin Li.

Reviewers: hfinkel, carlo.bertolli, kkwli0, arpith-jacob, ABataev

Subscribers: caomhin, cfe-commits

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

Added:
cfe/trunk/test/OpenMP/target_update_device_messages.cpp
cfe/trunk/test/OpenMP/target_update_if_messages.cpp
cfe/trunk/test/OpenMP/target_update_messages.cpp
Modified:
cfe/trunk/include/clang-c/Index.h
cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
cfe/trunk/include/clang/AST/StmtOpenMP.h
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Basic/OpenMPKinds.def
cfe/trunk/include/clang/Basic/StmtNodes.td
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/include/clang/Serialization/ASTBitCodes.h
cfe/trunk/lib/AST/StmtOpenMP.cpp
cfe/trunk/lib/AST/StmtPrinter.cpp
cfe/trunk/lib/AST/StmtProfile.cpp
cfe/trunk/lib/Basic/OpenMPKinds.cpp
cfe/trunk/lib/CodeGen/CGStmt.cpp
cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.h
cfe/trunk/lib/Parse/ParseOpenMP.cpp
cfe/trunk/lib/Sema/SemaOpenMP.cpp
cfe/trunk/lib/Sema/TreeTransform.h
cfe/trunk/lib/Serialization/ASTReaderStmt.cpp
cfe/trunk/lib/Serialization/ASTWriterStmt.cpp
cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
cfe/trunk/test/OpenMP/nesting_of_regions.cpp
cfe/trunk/tools/libclang/CIndex.cpp
cfe/trunk/tools/libclang/CXCursor.cpp

Modified: cfe/trunk/include/clang-c/Index.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=270878&r1=270877&r2=270878&view=diff
==
--- cfe/trunk/include/clang-c/Index.h (original)
+++ cfe/trunk/include/clang-c/Index.h Thu May 26 12:30:50 2016
@@ -2281,7 +2281,7 @@ enum CXCursorKind {
*/
   CXCursor_OMPTaskLoopSimdDirective  = 259,
 
-   /** \brief OpenMP distribute directive.
+  /** \brief OpenMP distribute directive.
*/
   CXCursor_OMPDistributeDirective= 260,
 
@@ -2301,7 +2301,11 @@ enum CXCursorKind {
*/
   CXCursor_OMPTargetParallelForDirective = 264,
 
-  CXCursor_LastStmt   = CXCursor_OMPTargetParallelForDirective,
+  /** \brief OpenMP target update directive.
+   */
+  CXCursor_OMPTargetUpdateDirective  = 265,
+
+  CXCursor_LastStmt  = CXCursor_OMPTargetUpdateDirective,
 
   /**
* \brief Cursor that represents the translation unit itself.

Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=270878&r1=270877&r2=270878&view=diff
==
--- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original)
+++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Thu May 26 12:30:50 2016
@@ -2502,6 +2502,9 @@ DEF_TRAVERSE_STMT(OMPTargetParallelForDi
 DEF_TRAVERSE_STMT(OMPTeamsDirective,
   { TRY_TO(TraverseOMPExecutableDirective(S)); })
 
+DEF_TRAVERSE_STMT(OMPTargetUpdateDirective,
+  { TRY_TO(TraverseOMPExecutableDirective(S)); })
+
 DEF_TRAVERSE_STMT(OMPTaskLoopDirective,
   { TRY_TO(TraverseOMPExecutableDirective(S)); })
 

Modified: cfe/trunk/include/clang/AST/StmtOpenMP.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/StmtOpenMP.h?rev=270878&r1=270877&r2=270878&view=diff
==
--- cfe/trunk/include/clang/AST/StmtOpenMP.h (original)
+++ cfe/trunk/include/clang/AST/StmtOpenMP.h Thu May 26 12:30:50 2016
@@ -2688,7 +2688,7 @@ public:
   /// \param Clauses List of clauses.
   /// \param AssociatedStmt Statement, associated with the directive.
   /// \param Exprs Helper expressions for CodeGen.
-///
+  ///
   static OMPDistributeDirective *
   Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
  unsigned CollapsedNum, ArrayRef Clauses,
@@ -2710,6 +2710,65 @@ public:
   }
 };
 
+/// \brief This represents '#pragma omp target update' directive.
+///
+/// \code
+/// #pragma omp target update to(a) from(b) device(1)
+/// \endcode
+/// In this example directive '#pragma omp target update' has clause 'to' with
+/// argument 'a', clause 'from' with argument 'b' and clause 'device' with
+/// argument '1'.
+///
+class OMPTargetUpdateDirective : public OMPExecutableD

Re: [PATCH] D15944: [OpenMP] Parsing and sema support for target update directive

2016-05-26 Thread Samuel Antao via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL270878: [OpenMP] Parsing and sema support for target update 
directive (authored by sfantao).

Changed prior to commit:
  http://reviews.llvm.org/D15944?vs=58469&id=58647#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D15944

Files:
  cfe/trunk/include/clang-c/Index.h
  cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
  cfe/trunk/include/clang/AST/StmtOpenMP.h
  cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
  cfe/trunk/include/clang/Basic/OpenMPKinds.def
  cfe/trunk/include/clang/Basic/StmtNodes.td
  cfe/trunk/include/clang/Sema/Sema.h
  cfe/trunk/include/clang/Serialization/ASTBitCodes.h
  cfe/trunk/lib/AST/StmtOpenMP.cpp
  cfe/trunk/lib/AST/StmtPrinter.cpp
  cfe/trunk/lib/AST/StmtProfile.cpp
  cfe/trunk/lib/Basic/OpenMPKinds.cpp
  cfe/trunk/lib/CodeGen/CGStmt.cpp
  cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
  cfe/trunk/lib/CodeGen/CodeGenFunction.h
  cfe/trunk/lib/Parse/ParseOpenMP.cpp
  cfe/trunk/lib/Sema/SemaOpenMP.cpp
  cfe/trunk/lib/Sema/TreeTransform.h
  cfe/trunk/lib/Serialization/ASTReaderStmt.cpp
  cfe/trunk/lib/Serialization/ASTWriterStmt.cpp
  cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
  cfe/trunk/test/OpenMP/nesting_of_regions.cpp
  cfe/trunk/test/OpenMP/target_update_device_messages.cpp
  cfe/trunk/test/OpenMP/target_update_if_messages.cpp
  cfe/trunk/test/OpenMP/target_update_messages.cpp
  cfe/trunk/tools/libclang/CIndex.cpp
  cfe/trunk/tools/libclang/CXCursor.cpp

Index: cfe/trunk/include/clang-c/Index.h
===
--- cfe/trunk/include/clang-c/Index.h
+++ cfe/trunk/include/clang-c/Index.h
@@ -2281,7 +2281,7 @@
*/
   CXCursor_OMPTaskLoopSimdDirective  = 259,
 
-   /** \brief OpenMP distribute directive.
+  /** \brief OpenMP distribute directive.
*/
   CXCursor_OMPDistributeDirective= 260,
 
@@ -2301,7 +2301,11 @@
*/
   CXCursor_OMPTargetParallelForDirective = 264,
 
-  CXCursor_LastStmt   = CXCursor_OMPTargetParallelForDirective,
+  /** \brief OpenMP target update directive.
+   */
+  CXCursor_OMPTargetUpdateDirective  = 265,
+
+  CXCursor_LastStmt  = CXCursor_OMPTargetUpdateDirective,
 
   /**
* \brief Cursor that represents the translation unit itself.
Index: cfe/trunk/include/clang/AST/StmtOpenMP.h
===
--- cfe/trunk/include/clang/AST/StmtOpenMP.h
+++ cfe/trunk/include/clang/AST/StmtOpenMP.h
@@ -2688,7 +2688,7 @@
   /// \param Clauses List of clauses.
   /// \param AssociatedStmt Statement, associated with the directive.
   /// \param Exprs Helper expressions for CodeGen.
-///
+  ///
   static OMPDistributeDirective *
   Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
  unsigned CollapsedNum, ArrayRef Clauses,
@@ -2710,6 +2710,65 @@
   }
 };
 
+/// \brief This represents '#pragma omp target update' directive.
+///
+/// \code
+/// #pragma omp target update to(a) from(b) device(1)
+/// \endcode
+/// In this example directive '#pragma omp target update' has clause 'to' with
+/// argument 'a', clause 'from' with argument 'b' and clause 'device' with
+/// argument '1'.
+///
+class OMPTargetUpdateDirective : public OMPExecutableDirective {
+  friend class ASTStmtReader;
+  /// \brief Build directive with the given start and end location.
+  ///
+  /// \param StartLoc Starting location of the directive kind.
+  /// \param EndLoc Ending Location of the directive.
+  /// \param NumClauses The number of clauses.
+  ///
+  OMPTargetUpdateDirective(SourceLocation StartLoc, SourceLocation EndLoc,
+   unsigned NumClauses)
+  : OMPExecutableDirective(this, OMPTargetUpdateDirectiveClass,
+   OMPD_target_update, StartLoc, EndLoc, NumClauses,
+   0) {}
+
+  /// \brief Build an empty directive.
+  ///
+  /// \param NumClauses Number of clauses.
+  ///
+  explicit OMPTargetUpdateDirective(unsigned NumClauses)
+  : OMPExecutableDirective(this, OMPTargetUpdateDirectiveClass,
+   OMPD_target_update, SourceLocation(),
+   SourceLocation(), NumClauses, 0) {}
+
+public:
+  /// \brief Creates directive with a list of \a Clauses.
+  ///
+  /// \param C AST context.
+  /// \param StartLoc Starting location of the directive kind.
+  /// \param EndLoc Ending Location of the directive.
+  /// \param Clauses List of clauses.
+  ///
+  static OMPTargetUpdateDirective *Create(const ASTContext &C,
+  SourceLocation StartLoc,
+  SourceLocation EndLoc,
+  ArrayRef Clauses);
+
+  /// \brief Creates an empty directive with the place for \a NumClauses
+  /// clauses.
+  ///
+  /// \param C AST context.
+  /// \param NumClauses The number 

Re: [PATCH] D18597: [OpenMP] Parsing and sema support for the to clause

2016-05-26 Thread Samuel Antao via cfe-commits
sfantao updated this revision to Diff 58651.
sfantao added a comment.

- Mark MappableVarListInfo as final.


http://reviews.llvm.org/D18597

Files:
  include/clang/AST/OpenMPClause.h
  include/clang/AST/RecursiveASTVisitor.h
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Basic/OpenMPKinds.def
  include/clang/Sema/Sema.h
  lib/AST/OpenMPClause.cpp
  lib/AST/StmtPrinter.cpp
  lib/AST/StmtProfile.cpp
  lib/Basic/OpenMPKinds.cpp
  lib/CodeGen/CGStmtOpenMP.cpp
  lib/Parse/ParseOpenMP.cpp
  lib/Sema/SemaOpenMP.cpp
  lib/Sema/TreeTransform.h
  lib/Serialization/ASTReaderStmt.cpp
  lib/Serialization/ASTWriterStmt.cpp
  test/OpenMP/nesting_of_regions.cpp
  test/OpenMP/target_map_messages.cpp
  test/OpenMP/target_parallel_for_map_messages.cpp
  test/OpenMP/target_parallel_map_messages.cpp
  test/OpenMP/target_update_ast_print.cpp
  test/OpenMP/target_update_device_messages.cpp
  test/OpenMP/target_update_if_messages.cpp
  test/OpenMP/target_update_messages.cpp
  test/OpenMP/target_update_to_messages.cpp
  tools/libclang/CIndex.cpp

Index: tools/libclang/CIndex.cpp
===
--- tools/libclang/CIndex.cpp
+++ tools/libclang/CIndex.cpp
@@ -2246,6 +2246,9 @@
 }
 void OMPClauseEnqueue::VisitOMPDefaultmapClause(
 const OMPDefaultmapClause * /*C*/) {}
+void OMPClauseEnqueue::VisitOMPToClause(const OMPToClause *C) {
+  VisitOMPClauseList(C);
+}
 }
 
 void EnqueueVisitor::EnqueueChildren(const OMPClause *S) {
Index: test/OpenMP/target_update_to_messages.cpp
===
--- /dev/null
+++ test/OpenMP/target_update_to_messages.cpp
@@ -0,0 +1,175 @@
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s
+
+void foo() {
+}
+
+bool foobool(int argc) {
+  return argc;
+}
+
+struct S1; // expected-note 2 {{declared here}}
+extern S1 a;
+class S2 {
+  mutable int a;
+public:
+  S2():a(0) { }
+  S2(S2 &s2):a(s2.a) { }
+  static float S2s; // expected-note 4 {{mappable type cannot contain static members}}
+  static const float S2sc; // expected-note 4 {{mappable type cannot contain static members}}
+};
+const float S2::S2sc = 0;
+const S2 b;
+const S2 ba[5];
+class S3 {
+  int a;
+public:
+  S3():a(0) { }
+  S3(S3 &s3):a(s3.a) { }
+};
+const S3 c;
+const S3 ca[5];
+extern const int f;
+class S4 {
+  int a;
+  S4();
+  S4(const S4 &s4);
+public:
+  S4(int v):a(v) { }
+};
+class S5 {
+  int a;
+  S5():a(0) {}
+  S5(const S5 &s5):a(s5.a) { }
+public:
+  S5(int v):a(v) { }
+};
+struct S6 {
+  int ii;
+  int aa[30];
+  float xx;
+  double *pp;
+};
+struct S7 {
+  int i;
+  int a[50];
+  float x;
+  S6 s6[5];
+  double *p;
+  unsigned bfa : 4;
+};
+
+S3 h;
+#pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}}
+
+typedef int from;
+
+template  // expected-note {{declared here}}
+T tmain(T argc) {
+  const T d = 5;
+  const T da[5] = { 0 };
+  S4 e(4);
+  S5 g(5);
+  T *m;
+  T i, t[20];
+  T &j = i;
+  T *k = &j;
+  T x;
+  T y;
+  T to;
+  const T (&l)[5] = da;
+  S7 s7;
+
+#pragma omp target update to // expected-error {{expected '(' after 'to'}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
+#pragma omp target update to( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
+#pragma omp target update to() // expected-error {{expected expression}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
+#pragma omp target update() // expected-warning {{extra tokens at the end of '#pragma omp target update' are ignored}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
+#pragma omp target update to(alloc) // expected-error {{use of undeclared identifier 'alloc'}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
+#pragma omp target update to(x)
+#pragma omp target update to(t[:I])
+#pragma omp target update to(T) // expected-error {{'T' does not refer to a value}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
+#pragma omp target update to(I) // expected-error 2 {{expected expression containing only member accesses and/or array sections based on named variables}}
+#pragma omp target update to(S2::S2s)
+#pragma omp target update to(S2::S2sc)
+#pragma omp target update to(to)
+#pragma omp target update to(y x) // expected-error {{expected ',' or ')' in 'to' clause}}
+#pragma omp target update to(argc > 0 ? x : y) // expected-error 2 {{expected expression containing only member accesses and/or array sections based on named variables}} 
+#pragma omp target update to(S1) // expected-error {{'S1' does not refe

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

2016-05-26 Thread Varju Janos via cfe-commits
varjujan created this revision.
varjujan added a reviewer: alexfh.
varjujan added subscribers: xazax.hun, cfe-commits.

This checker finds those function calls where the function arguments are 
provided in an incorrect order. It compares the name of the given variable to 
the argument name in the function definition.

It issues a message if the given variable name is similar to an another 
function argument in a function call. It uses case insensitive comparison.

http://reviews.llvm.org/D20689

Files:
  clang-tidy/misc/CMakeLists.txt
  clang-tidy/misc/MiscTidyModule.cpp
  clang-tidy/misc/SuspiciousCallArgumentCheck.cpp
  clang-tidy/misc/SuspiciousCallArgumentCheck.h
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/misc-suspicious-call-argument.rst
  test/clang-tidy/misc-suspicious-call-argument.cpp

Index: test/clang-tidy/misc-suspicious-call-argument.cpp
===
--- /dev/null
+++ test/clang-tidy/misc-suspicious-call-argument.cpp
@@ -0,0 +1,106 @@
+// RUN: %check_clang_tidy %s misc-suspicious-call-argument %t -- -- -std=c++11
+
+// For equality test.
+void set(int *buff, int value, int count) {
+  while (count > 0) {
+*buff = value;
+++buff;
+--count;
+  }
+}
+
+// For equality test.
+void foo(int *array, int count) {
+  // Equality test.
+  set(array, count, 10);
+  // CHECK-MESSAGES: :[[@LINE-1]]:4: warning: count (value) is potentially swapped with literal (count). [misc-suspicious-call-argument]
+}
+
+// For equality test.
+void f(int b, int aaa) {}
+
+// For prefix/suffix test.
+int uselessFoo(int valToRet, int uselessParam) { return valToRet; }
+
+// For variadic function test.
+double average(int count, int fixParam1, int fixParam2, ...) { return 0.0; }
+
+void fooo(int asdasdasd, int bbb, int ccc = 1, int ddd = 0) {}
+
+class TestClass {
+public:
+  void thisFunction(int integerParam, int thisIsPARAM) {}
+};
+
+int main() {
+  int asdasdasd, qweqweqweq, cc, ddd = 0;
+
+  fooo(asdasdasd, cc);
+  // CHECK-MESSAGES: :[[@LINE-1]]:2: warning: cc (bbb) is potentially swapped with literal (ccc). [misc-suspicious-call-argument]
+
+  const int MAX = 15;
+  int *array = new int[MAX];
+  int count = 5;
+
+  // Equality test 1.
+  foo(array, count);
+
+  // Equality test 2.
+  double avg = average(1, 2, count, 3, 4, 5, 6,
+   7); // "count" should be the first argument
+  // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: literal (count) is potentially swapped with count (fixParam2). [misc-suspicious-call-argument]
+
+  // Equality test 3.
+  int aa, aaa = 0;
+  f(aa, aaa); // should pass (0. arg is similar to 1. param, but 1. arg is equal to 1. param)
+
+  // Equality test 4.
+  int fixParam1 = 5;
+  avg = average(count, 1, 2, 3, 4, fixParam1, 6,
+7); // should pass, we only check params and args before "..."
+
+  // Levenshtein test 1.
+  int cooundt = 4;
+  set(array, cooundt, 10); // "cooundt" is similar to "count"
+  // CHECK-MESSAGES: :[[@LINE-1]]:2: warning: cooundt (value) is potentially swapped with literal (count). [misc-suspicious-call-argument]
+
+  // Levenshtein test 2.
+  int _value = 3;
+  set(array, 5, _value); // "_value" is similar to "value"
+  // CHECK-MESSAGES: :[[@LINE-1]]:2: warning: literal (value) is potentially swapped with _value (count). [misc-suspicious-call-argument]
+
+  // Prefix test 1.
+  int val = 1;
+  int tmp = uselessFoo(5, val); // "val" is a prefix of "valToRet"
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: literal (valToRet) is potentially swapped with val (uselessParam). [misc-suspicious-call-argument]
+
+  // Prefix test 2.
+  int VALtoretAwesome = 1;
+  tmp = uselessFoo(
+  5, VALtoretAwesome); // "valToRet" is a prefix of "VALtoretAwesome"
+  // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: literal (valToRet) is potentially swapped with VALtoretAwesome (uselessParam). [misc-suspicious-call-argument]
+
+  // Suffix test 1.
+  int param = 1;
+  int randomValue = 5;
+  tmp = uselessFoo(param, randomValue); // "param" is a suffix of "uselessParam"
+  // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: param (valToRet) is swapped with randomValue (uselessParam). [misc-suspicious-call-argument]
+
+  // Suffix test 2.
+  int reallyUselessParam = 1;
+  tmp = uselessFoo(reallyUselessParam,
+   5); // "uselessParam" is a suffix of "reallyUselessParam"
+  // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: reallyUselessParam (valToRet) is potentially swapped with literal (uselessParam). [misc-suspicious-call-argument]
+
+  // Test lambda.
+  auto testMethod = [&](int method, int randomParam) { return 0; };
+  int method = 0;
+  testMethod(method, 0); // Should pass.
+
+  // Member function test
+  TestClass test;
+  int integ, thisIsAnArg = 0;
+  test.thisFunction(integ, thisIsAnArg); // Should pass.
+
+  return 0;
+}
Index: docs/clang-tidy/checks/misc-suspicious-call-argument.rst
===
--- 

r270880 - [OpenMP] Parsing and sema support for the to clause

2016-05-26 Thread Samuel Antao via cfe-commits
Author: sfantao
Date: Thu May 26 12:39:58 2016
New Revision: 270880

URL: http://llvm.org/viewvc/llvm-project?rev=270880&view=rev
Log:
[OpenMP] Parsing and sema support for the to clause

Summary:
The patch contains the parsing and sema support for the `to` clause. 

Patch based on the original post by Kelvin Li.

Reviewers: carlo.bertolli, hfinkel, kkwli0, arpith-jacob, ABataev

Subscribers: caomhin, cfe-commits

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

Added:
cfe/trunk/test/OpenMP/target_update_ast_print.cpp
cfe/trunk/test/OpenMP/target_update_to_messages.cpp
Modified:
cfe/trunk/include/clang/AST/OpenMPClause.h
cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Basic/OpenMPKinds.def
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/AST/OpenMPClause.cpp
cfe/trunk/lib/AST/StmtPrinter.cpp
cfe/trunk/lib/AST/StmtProfile.cpp
cfe/trunk/lib/Basic/OpenMPKinds.cpp
cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
cfe/trunk/lib/Parse/ParseOpenMP.cpp
cfe/trunk/lib/Sema/SemaOpenMP.cpp
cfe/trunk/lib/Sema/TreeTransform.h
cfe/trunk/lib/Serialization/ASTReaderStmt.cpp
cfe/trunk/lib/Serialization/ASTWriterStmt.cpp
cfe/trunk/test/OpenMP/nesting_of_regions.cpp
cfe/trunk/test/OpenMP/target_map_messages.cpp
cfe/trunk/test/OpenMP/target_parallel_for_map_messages.cpp
cfe/trunk/test/OpenMP/target_parallel_map_messages.cpp
cfe/trunk/test/OpenMP/target_update_device_messages.cpp
cfe/trunk/test/OpenMP/target_update_if_messages.cpp
cfe/trunk/test/OpenMP/target_update_messages.cpp
cfe/trunk/tools/libclang/CIndex.cpp

Modified: cfe/trunk/include/clang/AST/OpenMPClause.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/OpenMPClause.h?rev=270880&r1=270879&r2=270880&view=diff
==
--- cfe/trunk/include/clang/AST/OpenMPClause.h (original)
+++ cfe/trunk/include/clang/AST/OpenMPClause.h Thu May 26 12:39:58 2016
@@ -4010,6 +4010,109 @@ public:
 return child_range(child_iterator(), child_iterator());
   }
 };
+
+/// \brief This represents clause 'to' in the '#pragma omp ...'
+/// directives.
+///
+/// \code
+/// #pragma omp target update to(a,b)
+/// \endcode
+/// In this example directive '#pragma omp target update' has clause 'to'
+/// with the variables 'a' and 'b'.
+///
+class OMPToClause final : public OMPMappableExprListClause,
+  private llvm::TrailingObjects<
+  OMPToClause, Expr *, ValueDecl *, unsigned,
+  OMPClauseMappableExprCommon::MappableComponent> {
+  friend TrailingObjects;
+  friend OMPVarListClause;
+  friend OMPMappableExprListClause;
+  friend class OMPClauseReader;
+
+  /// Define the sizes of each trailing object array except the last one. This
+  /// is required for TrailingObjects to work properly.
+  size_t numTrailingObjects(OverloadToken) const {
+return varlist_size();
+  }
+  size_t numTrailingObjects(OverloadToken) const {
+return getUniqueDeclarationsNum();
+  }
+  size_t numTrailingObjects(OverloadToken) const {
+return getUniqueDeclarationsNum() + getTotalComponentListNum();
+  }
+
+  /// \brief Build clause with number of variables \a NumVars.
+  ///
+  /// \param StartLoc Starting location of the clause.
+  /// \param EndLoc Ending location of the clause.
+  /// \param NumVars Number of expressions listed in this clause.
+  /// \param NumUniqueDeclarations Number of unique base declarations in this
+  /// clause.
+  /// \param NumComponentLists Number of component lists in this clause.
+  /// \param NumComponents Total number of expression components in the clause.
+  ///
+  explicit OMPToClause(SourceLocation StartLoc, SourceLocation LParenLoc,
+   SourceLocation EndLoc, unsigned NumVars,
+   unsigned NumUniqueDeclarations,
+   unsigned NumComponentLists, unsigned NumComponents)
+  : OMPMappableExprListClause(OMPC_to, StartLoc, LParenLoc, EndLoc, 
NumVars,
+  NumUniqueDeclarations, NumComponentLists,
+  NumComponents) {}
+
+  /// \brief Build an empty clause.
+  ///
+  /// \param NumVars Number of expressions listed in this clause.
+  /// \param NumUniqueDeclarations Number of unique base declarations in this
+  /// clause.
+  /// \param NumComponentLists Number of component lists in this clause.
+  /// \param NumComponents Total number of expression components in the clause.
+  ///
+  explicit OMPToClause(unsigned NumVars, unsigned NumUniqueDeclarations,
+   unsigned NumComponentLists, unsigned NumComponents)
+  : OMPMappableExprListClause(
+OMPC_to, SourceLocation(), SourceLocation(), SourceLocation(),
+NumVars, NumUniqueDeclarations, NumComponentLists, NumComponents)

r270882 - [OpenMP] Parsing and sema support for the from clause

2016-05-26 Thread Samuel Antao via cfe-commits
Author: sfantao
Date: Thu May 26 12:49:04 2016
New Revision: 270882

URL: http://llvm.org/viewvc/llvm-project?rev=270882&view=rev
Log:
[OpenMP] Parsing and sema support for the from clause

Summary:
The patch contains the parsing and sema support for the `from` clause. 

Patch based on the original post by Kelvin Li.

Reviewers: hfinkel, carlo.bertolli, kkwli0, arpith-jacob, ABataev

Subscribers: caomhin, cfe-commits

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

Added:
cfe/trunk/test/OpenMP/target_update_from_messages.cpp
Modified:
cfe/trunk/include/clang/AST/OpenMPClause.h
cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
cfe/trunk/include/clang/Basic/OpenMPKinds.def
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/AST/OpenMPClause.cpp
cfe/trunk/lib/AST/StmtPrinter.cpp
cfe/trunk/lib/AST/StmtProfile.cpp
cfe/trunk/lib/Basic/OpenMPKinds.cpp
cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
cfe/trunk/lib/Parse/ParseOpenMP.cpp
cfe/trunk/lib/Sema/SemaOpenMP.cpp
cfe/trunk/lib/Sema/TreeTransform.h
cfe/trunk/lib/Serialization/ASTReaderStmt.cpp
cfe/trunk/lib/Serialization/ASTWriterStmt.cpp
cfe/trunk/test/OpenMP/target_update_ast_print.cpp
cfe/trunk/test/OpenMP/target_update_device_messages.cpp
cfe/trunk/test/OpenMP/target_update_if_messages.cpp
cfe/trunk/test/OpenMP/target_update_messages.cpp
cfe/trunk/test/OpenMP/target_update_to_messages.cpp
cfe/trunk/tools/libclang/CIndex.cpp

Modified: cfe/trunk/include/clang/AST/OpenMPClause.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/OpenMPClause.h?rev=270882&r1=270881&r2=270882&view=diff
==
--- cfe/trunk/include/clang/AST/OpenMPClause.h (original)
+++ cfe/trunk/include/clang/AST/OpenMPClause.h Thu May 26 12:49:04 2016
@@ -4113,6 +4113,110 @@ public:
reinterpret_cast(varlist_end()));
   }
 };
+
+/// \brief This represents clause 'from' in the '#pragma omp ...'
+/// directives.
+///
+/// \code
+/// #pragma omp target update from(a,b)
+/// \endcode
+/// In this example directive '#pragma omp target update' has clause 'from'
+/// with the variables 'a' and 'b'.
+///
+class OMPFromClause final
+: public OMPMappableExprListClause,
+  private llvm::TrailingObjects<
+  OMPFromClause, Expr *, ValueDecl *, unsigned,
+  OMPClauseMappableExprCommon::MappableComponent> {
+  friend TrailingObjects;
+  friend OMPVarListClause;
+  friend OMPMappableExprListClause;
+  friend class OMPClauseReader;
+
+  /// Define the sizes of each trailing object array except the last one. This
+  /// is required for TrailingObjects to work properly.
+  size_t numTrailingObjects(OverloadToken) const {
+return varlist_size();
+  }
+  size_t numTrailingObjects(OverloadToken) const {
+return getUniqueDeclarationsNum();
+  }
+  size_t numTrailingObjects(OverloadToken) const {
+return getUniqueDeclarationsNum() + getTotalComponentListNum();
+  }
+
+  /// \brief Build clause with number of variables \a NumVars.
+  ///
+  /// \param StartLoc Starting location of the clause.
+  /// \param EndLoc Ending location of the clause.
+  /// \param NumVars Number of expressions listed in this clause.
+  /// \param NumUniqueDeclarations Number of unique base declarations in this
+  /// clause.
+  /// \param NumComponentLists Number of component lists in this clause.
+  /// \param NumComponents Total number of expression components in the clause.
+  ///
+  explicit OMPFromClause(SourceLocation StartLoc, SourceLocation LParenLoc,
+ SourceLocation EndLoc, unsigned NumVars,
+ unsigned NumUniqueDeclarations,
+ unsigned NumComponentLists, unsigned NumComponents)
+  : OMPMappableExprListClause(OMPC_from, StartLoc, LParenLoc, EndLoc,
+  NumVars, NumUniqueDeclarations,
+  NumComponentLists, NumComponents) {}
+
+  /// \brief Build an empty clause.
+  ///
+  /// \param NumVars Number of expressions listed in this clause.
+  /// \param NumUniqueDeclarations Number of unique base declarations in this
+  /// clause.
+  /// \param NumComponentLists Number of component lists in this clause.
+  /// \param NumComponents Total number of expression components in the clause.
+  ///
+  explicit OMPFromClause(unsigned NumVars, unsigned NumUniqueDeclarations,
+ unsigned NumComponentLists, unsigned NumComponents)
+  : OMPMappableExprListClause(
+OMPC_from, SourceLocation(), SourceLocation(), SourceLocation(),
+NumVars, NumUniqueDeclarations, NumComponentLists, NumComponents) 
{}
+
+public:
+  /// \brief Creates clause with a list of variables \a Vars.
+  ///
+  /// \param C AST context.
+  /// \brief StartLoc Starting location of the clause.
+  /// \brief EndLoc Ending location of the clause.
+  /// \param Vars The ori

[PATCH] D20693: New checker to replace dynamic exception specifications

2016-05-26 Thread don hinton via cfe-commits
hintonda created this revision.
hintonda added reviewers: alexfh, aaron.ballman.
hintonda added subscribers: etienneb, Eugene.Zelenko, cfe-commits.

[clang-tidy] New checker to replace dynamic exception
specifications

This is an alternative to D18575 which relied on reparsing the decl to
find the location of dynamic exception specifications, but couldn't
deal with preprocessor conditionals correctly without reparsing the
entire file.

This approach uses D20428 to find dynamic exception specifiaction
locations and handles all cases correctly.

http://reviews.llvm.org/D20693

Files:
  clang-tidy/modernize/CMakeLists.txt
  clang-tidy/modernize/ModernizeTidyModule.cpp
  clang-tidy/modernize/UseNoexceptCheck.cpp
  clang-tidy/modernize/UseNoexceptCheck.h
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/modernize-use-noexcept.rst
  test/clang-tidy/modernize-use-noexcept-macro.cpp
  test/clang-tidy/modernize-use-noexcept.cpp

Index: test/clang-tidy/modernize-use-noexcept.cpp
===
--- /dev/null
+++ test/clang-tidy/modernize-use-noexcept.cpp
@@ -0,0 +1,56 @@
+// RUN: %check_clang_tidy %s modernize-use-noexcept %t -- \
+// RUN:   -- -std=c++11
+
+class A {};
+class B {};
+
+void foo() throw();
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: found dynamic exception specification 'throw()' [modernize-use-noexcept]
+// CHECK-FIXES: void foo() noexcept;
+
+void bar() throw(...);
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: found dynamic exception specification 'throw(...)' [modernize-use-noexcept]
+// CHECK-FIXES: void bar() noexcept(false);
+
+void k() throw(int(int));
+// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: found dynamic exception specification 'throw(int(int))' [modernize-use-noexcept]
+// CHECK-FIXES: void k() noexcept(false);
+
+void foobar() throw(A, B)
+{}
+// CHECK-MESSAGES: :[[@LINE-2]]:15: warning: found dynamic exception specification 'throw(A, B)' [modernize-use-noexcept]
+// CHECK-FIXES: void foobar() noexcept(false)
+
+void baz(int = (throw A(), 0)) throw(A, B) {}
+// CHECK-MESSAGES: :[[@LINE-1]]:32: warning: found dynamic exception specification 'throw(A, B)' [modernize-use-noexcept]
+// CHECK-FIXES: void baz(int = (throw A(), 0)) noexcept(false) {}
+
+void g(void (*fp)(void) throw());
+// CHECK-MESSAGES: :[[@LINE-1]]:25: warning: found dynamic exception specification 'throw()' [modernize-use-noexcept]
+// CHECK-FIXES: void g(void (*fp)(void) noexcept);
+
+void f(void (*fp)(void) throw()) throw(char);
+// CHECK-MESSAGES: :[[@LINE-1]]:25: warning: found dynamic exception specification 'throw()' [modernize-use-noexcept]
+// CHECK-MESSAGES: :[[@LINE-2]]:34: warning: found dynamic exception specification 'throw(char)' [modernize-use-noexcept]
+// CHECK-FIXES: void f(void (*fp)(void) noexcept) noexcept(false);
+
+void j() throw(int(int) throw(void(void) throw(int)));
+// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: found dynamic exception specification 'throw(int(int) throw(void(void) throw(int)))' [modernize-use-noexcept]
+// CHECK-FIXES: void j() noexcept(false);
+
+class Y {
+  Y() throw() = default;
+};
+// CHECK-MESSAGES: :[[@LINE-2]]:7: warning: found dynamic exception specification 'throw()' [modernize-use-noexcept]
+// CHECK-FIXES: Y() noexcept = default;
+
+// Should not trigger a replacement.
+void titi() noexcept {}
+void toto() noexcept(true) {}
+
+// Should not trigger a replacement.
+void bad()
+#if !__has_feature(cxx_noexcept)
+throw()
+#endif
+;
Index: test/clang-tidy/modernize-use-noexcept-macro.cpp
===
--- /dev/null
+++ test/clang-tidy/modernize-use-noexcept-macro.cpp
@@ -0,0 +1,24 @@
+// RUN: %check_clang_tidy %s modernize-use-noexcept %t -- \
+// RUN:   -config="{CheckOptions: [{key: modernize-use-noexcept.ReplacementString, value: 'NOEXCEPT'}]}" \
+// RUN:   -- -std=c++11
+
+// Example definition of NOEXCEPT -- simplified test to see if noexcept is supported. 
+#if (__has_feature(cxx_noexcept))
+#define NOEXCEPT noexcept
+#else
+#define NOEXCEPT throw()
+#endif
+
+void bar() throw() {}
+// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: found dynamic exception specification 'throw()' [modernize-use-noexcept]
+// CHECK-FIXES: void bar() NOEXCEPT {}
+
+// Should not trigger a FixItHint, since macros only support noexcept, and this
+// case throws.
+class A {};
+class B {};
+void foobar() throw(A, B);
+// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: found dynamic exception specification 'throw(A, B)' [modernize-use-noexcept]
+
+// Should not trigger a replacement.
+void foo() noexcept(true);
Index: docs/clang-tidy/checks/modernize-use-noexcept.rst
===
--- /dev/null
+++ docs/clang-tidy/checks/modernize-use-noexcept.rst
@@ -0,0 +1,55 @@
+.. title:: clang-tidy - modernize-use-noexcept
+
+modernize-use-noexcept
+==
+
+The check converts dynamic exception specifications, e.g., ``throw(

Re: [PATCH] D20602: Add .rgba syntax extension to ext_vector_type types

2016-05-26 Thread Pirama Arumuga Nainar via cfe-commits
pirama added inline comments.


Comment at: include/clang/Basic/DiagnosticSemaKinds.td:7900
@@ -7897,1 +7899,3 @@
+def ext_opencl_ext_vector_type_rgba_selector: ExtWarn<
+  "vector component name '%0' is an OpenCL 2.2 extension">;
 } // end of sema category

Anastasia wrote:
> Could it be an error instead for CL <2.2? It isn't a valid feature and we 
> have already rejected similar cases with an error. 
> 
> How about changing to something like:
>   "vector component name '%0' is not supported in earlier than OpenCL version 
> 2.2"
> 
> See similar diagnostics above - err_opencl_invalid_read_write, 
> err_opencl_unknown_type_specifier.
> 
> Using extension might be confusing because we have core spec and extension 
> spec in OpenCL.
Since .rgba is just a syntactic feature in the frontend that requires no 
support from the runtime, should this be an error?  Making this an ExtWarn, 
like Richard suggested, will reject these under -pedantic-errors.  But I'll let 
you make this call.

I'll update the diagnostic message to the following, if that's ok:

> "vector component name '%0' cannot be used earlier than OpenCL version 2.2.




http://reviews.llvm.org/D20602



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


Re: [PATCH] D18575: [clang-tidy] New checker to replace deprecated throw() specifications

2016-05-26 Thread don hinton via cfe-commits
hintonda added a comment.

Please see http://reviews.llvm.org/D20693 for an alternative approach.


http://reviews.llvm.org/D18575



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


Re: [PATCH] D20683: [MSVC2015] Fix mangling for static variables initialization guards

2016-05-26 Thread Reid Kleckner via cfe-commits
rnk accepted this revision.
rnk added a reviewer: rnk.
rnk added a comment.
This revision is now accepted and ready to land.

lgtm, agreed, looks like an oversight.


http://reviews.llvm.org/D20683



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


RE: [PATCH] D20681: Add target-specific pre-linking passes to Clang

2016-05-26 Thread Liu, Yaxun (Sam) via cfe-commits
+Jeff

To cite some of the previous discussions 
(http://lists.llvm.org/pipermail/cfe-dev/2016-May/048822.html )

Brian:

On our side, we use such pre-link passes to interface with the specifics of our 
built-in function library.  For example, we transform printf calls into a form 
that interacts with our library.  We also transform calls to pipe functions, 
kernel enqueue related functions, and transform calls to the atomic functions 
to corresponding LLVM atomic instructions (and keep track of the memory scope 
elsewhere currently).  You may have noticed that we have a proposal out to 
enable the atomic instructions to directly carry a memory scope.

Jeff:

We have similar passes related to builtin functions but they are rather 
specific to our implementation and not too complex.

Thanks.

Sam


-Original Message-
From: Liu, Yaxun (Sam) 
Sent: Thursday, May 26, 2016 11:44 AM
To: reviews+d20681+public+7364792746786...@reviews.llvm.org; 
rich...@metafoo.co.uk; anastasia.stul...@arm.com
Cc: Stellard, Thomas ; cfe-commits@lists.llvm.org; 
Sumner, Brian 
Subject: RE: [PATCH] D20681: Add target-specific pre-linking passes to Clang

+ Brian

-Original Message-
From: Tom Stellard [mailto:thomas.stell...@amd.com] 
Sent: Thursday, May 26, 2016 11:11 AM
To: Liu, Yaxun (Sam) ; rich...@metafoo.co.uk; 
anastasia.stul...@arm.com
Cc: Stellard, Thomas ; cfe-commits@lists.llvm.org
Subject: Re: [PATCH] D20681: Add target-specific pre-linking passes to Clang

tstellarAMD added a comment.

Can you give some examples of what pre-link passes may be required?


http://reviews.llvm.org/D20681



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


Re: [PATCH] D19274: Compilation for Intel MCU (Part 2/3)

2016-05-26 Thread Bruno Cardoso Lopes via cfe-commits
bruno added inline comments.


Comment at: lib/Driver/Tools.cpp:3657
@@ +3656,3 @@
+  if (IsIAMCU && types::isCXX(Input.getType()))
+D.Diag(diag::err_drv_cxx_not_supported) << 
getToolChain().getTriple().str();
+

aturetsk wrote:
> bruno wrote:
> > Taking a look at this again I don't think there's a real need for a new 
> > diagnostic here; instead of adding diag::err_drv_cxx_not_supported, you can 
> > do something similar to:
> > 
> > D.Diag(diag::err_drv_clang_unsupported) << "C++ is not supported with 
> > -miamcu"
> > 
> > Otherwise, LGTM!
> The best thing I could come up with is this:
> ```
> D.Diag(diag::err_drv_clang_unsupported) << "C++ for IAMCU";
> ```
> This code makes the error message look like this:
> ```
> error: the clang compiler does not support 'C++ for IAMCU'
> ```
> As you can see the message is a bit crooked. Do you thinks it's better to 
> keep it this way?
Sorry, but I didn't mean you should change the message. My only point here is 
that I don't see the need for adding a new diagnostic, you can still keep 
something more similar with your old intent, example:

  D.Diag(diag::err_drv_clang_unsupported) << "C++ for target" << 
getToolChain().getTriple().str();


http://reviews.llvm.org/D19274



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


Re: [PATCH] D20675: Compilation for Intel MCU (Part 3/3)

2016-05-26 Thread Bruno Cardoso Lopes via cfe-commits
bruno accepted this revision.
bruno added a comment.
This revision is now accepted and ready to land.

LGTM


http://reviews.llvm.org/D20675



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


Re: [PATCH] D20404: [Driver] Fix driver support for color diagnostics

2016-05-26 Thread Bruno Cardoso Lopes via cfe-commits
bruno added a comment.

Ping!


http://reviews.llvm.org/D20404



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


Re: [PATCH] D20451: [Parser] Fix look ahead after EOF while parsing objc message and lambdas

2016-05-26 Thread Bruno Cardoso Lopes via cfe-commits
bruno added a comment.

Ping!


http://reviews.llvm.org/D20451



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


Re: [PATCH] D20650: [OpenMP] Codegen for target update directive.

2016-05-26 Thread Samuel Antao via cfe-commits
sfantao updated this revision to Diff 58658.
sfantao added a comment.

- Adapt target update tests bits to reflect latest changes in the trunk.


http://reviews.llvm.org/D20650

Files:
  lib/CodeGen/CGOpenMPRuntime.cpp
  lib/CodeGen/CGOpenMPRuntime.h
  lib/CodeGen/CGStmtOpenMP.cpp
  test/OpenMP/target_update_codegen.cpp

Index: test/OpenMP/target_update_codegen.cpp
===
--- /dev/null
+++ test/OpenMP/target_update_codegen.cpp
@@ -0,0 +1,245 @@
+// expected-no-diagnostics
+#ifndef HEADER
+#define HEADER
+
+///==///
+// RUN: %clang_cc1 -DCK1 -verify -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-64
+// RUN: %clang_cc1 -DCK1 -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s  --check-prefix CK1 --check-prefix CK1-64
+// RUN: %clang_cc1 -DCK1 -verify -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s  --check-prefix CK1 --check-prefix CK1-32
+// RUN: %clang_cc1 -DCK1 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -fomptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s  --check-prefix CK1 --check-prefix CK1-32
+#ifdef CK1
+
+// CK1: [[ST:%.+]] = type { i32, double* }
+template 
+struct ST {
+  T a;
+  double *b;
+};
+
+ST gb;
+double gc[100];
+
+// CK1: [[SIZE00:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 800]
+// CK1: [[MTYPE00:@.+]] = {{.+}}constant [1 x i32] [i32 34]
+
+// CK1: [[SIZE02:@.+]] = {{.+}}constant [1 x i[[sz]]] [i[[sz]] 4]
+// CK1: [[MTYPE02:@.+]] = {{.+}}constant [1 x i32] [i32 33]
+
+// CK1: [[MTYPE03:@.+]] = {{.+}}constant [1 x i32] [i32 34]
+
+// CK1: [[SIZE04:@.+]] = {{.+}}constant [2 x i[[sz]]] [i[[sz]] {{8|4}}, i[[sz]] 24]
+// CK1: [[MTYPE04:@.+]] = {{.+}}constant [2 x i32] [i32 33, i32 17]
+
+// CK1-LABEL: _Z3fooi
+void foo(int arg) {
+  int la;
+  float lb[arg];
+
+  // Region 00
+  // CK1-DAG: call void @__tgt_target_data_update(i32 [[DEV:%[^,]+]], i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
+  // CK1-DAG: [[DEV]] = load i32, i32* %{{[^,]+}},
+  // CK1-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
+  // CK1-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
+
+  // CK1-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
+  // CK1-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
+  // CK1-DAG: store i8* bitcast ([100 x double]* @gc to i8*), i8** [[BP0]]
+  // CK1-DAG: store i8* bitcast ([100 x double]* @gc to i8*), i8** [[P0]]
+
+  // CK1: %{{.+}} = add nsw i32 %{{[^,]+}}, 1
+  #pragma omp target update if(1+3-5) device(arg) from(gc)
+  {++arg;}
+
+  // Region 01
+  // CK1: %{{.+}} = add nsw i32 %{{[^,]+}}, 1
+  #pragma omp target update to(la) if(1+3-4)
+  {++arg;}
+
+  // Region 02
+  // CK1: br i1 %{{[^,]+}}, label %[[IFTHEN:[^,]+]], label %[[IFELSE:[^,]+]]
+  // CK1: [[IFTHEN]]
+  // CK1-DAG: call void @__tgt_target_data_update(i32 4, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}})
+  // CK1-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
+  // CK1-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
+
+  // CK1-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
+  // CK1-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
+  // CK1-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
+  // CK1-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
+  // CK1-DAG: [[CBPVAL0]] = bitcast i32* [[VAR0:%.+]] to i8*
+  // CK1-DAG: [[CPVAL0]] = bitcast i32* [[VAR0]] to i8*
+  // CK1: br label %[[IFEND:[^,]+]]
+
+  // CK1: [[IFELSE]]
+  // CK1: br label %[[IFEND]]
+  // CK1: [[IFEND]]
+  // CK1: %{{.+}} = add nsw i32 %{{[^,]+}}, 1
+  #pragma omp target update to(arg) if(arg) device(4)
+  {++arg;}
+
+  // CK1: %{{.+}} = add nsw i32 %{{[^,]+}}, 1
+  {++arg;}
+
+  // Region 03
+  // CK1-DAG: call void @__tgt_target_data_update(i32 -1, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[sz]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
+  // CK1-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
+  // CK1-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
+  // CK1-DAG: [[GEPS]] = getele

  1   2   >