[PATCH] D31174: [X86][MS-compatability] allow MS TYPE/SIZE/LENGTH operators as a part of a compound expression

2017-03-21 Thread coby via Phabricator via cfe-commits
coby created this revision.

This patch introduces X86AsmParser with the ability to handle the 
aforementioned ops within compound "MS" arithmetical expressions. Currently - 
only supported as a stand alone Operand, e.g.:
"TYPE X"
now allowed :
"4 + TYPE X * 128"

LLVM side: https://reviews.llvm.org/D31173


Repository:
  rL LLVM

https://reviews.llvm.org/D31174

Files:
  test/CodeGen/ms-inline-asm.c


Index: test/CodeGen/ms-inline-asm.c
===
--- test/CodeGen/ms-inline-asm.c
+++ test/CodeGen/ms-inline-asm.c
@@ -201,6 +201,8 @@
 // CHECK: mov eax, $$4
   __asm mov eax, LENGTH _bar
 // CHECK: mov eax, $$2
+  __asm mov eax, [eax + LENGTH foo * 4]
+// CHECK: mov eax, [eax + $$1 * $$4]
 
   __asm mov eax, TYPE foo
 // CHECK: mov eax, $$4
@@ -210,16 +212,21 @@
 // CHECK: mov eax, $$4
   __asm mov eax, TYPE _bar
 // CHECK: mov eax, $$1
+  __asm mov eax, [eax + TYPE foo * 4]
+// CHECK: mov eax, [eax + $$4 * $$4]
 
   __asm mov eax, SIZE foo
 // CHECK: mov eax, $$4
   __asm mov eax, SIZE bar
 // CHECK: mov eax, $$1
   __asm mov eax, SIZE _foo
 // CHECK: mov eax, $$16
+  __asm mov eax, [eax + SIZE _foo * 4]
+// CHECK: mov eax, [eax + $$16 * $$4]
   __asm mov eax, SIZE _bar
 // CHECK: mov eax, $$2
 // CHECK: "~{eax},~{dirflag},~{fpsr},~{flags}"()
+
 }
 
 void t21() {


Index: test/CodeGen/ms-inline-asm.c
===
--- test/CodeGen/ms-inline-asm.c
+++ test/CodeGen/ms-inline-asm.c
@@ -201,6 +201,8 @@
 // CHECK: mov eax, $$4
   __asm mov eax, LENGTH _bar
 // CHECK: mov eax, $$2
+  __asm mov eax, [eax + LENGTH foo * 4]
+// CHECK: mov eax, [eax + $$1 * $$4]
 
   __asm mov eax, TYPE foo
 // CHECK: mov eax, $$4
@@ -210,16 +212,21 @@
 // CHECK: mov eax, $$4
   __asm mov eax, TYPE _bar
 // CHECK: mov eax, $$1
+  __asm mov eax, [eax + TYPE foo * 4]
+// CHECK: mov eax, [eax + $$4 * $$4]
 
   __asm mov eax, SIZE foo
 // CHECK: mov eax, $$4
   __asm mov eax, SIZE bar
 // CHECK: mov eax, $$1
   __asm mov eax, SIZE _foo
 // CHECK: mov eax, $$16
+  __asm mov eax, [eax + SIZE _foo * 4]
+// CHECK: mov eax, [eax + $$16 * $$4]
   __asm mov eax, SIZE _bar
 // CHECK: mov eax, $$2
 // CHECK: "~{eax},~{dirflag},~{fpsr},~{flags}"()
+
 }
 
 void t21() {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D31082: [mips][msa] Range adjustment for ldi_b builtin function operand

2017-03-21 Thread Stefan Maksimovic via Phabricator via cfe-commits
smaksimovic updated this revision to Diff 92439.
smaksimovic added a comment.

Added a new test to test/CodeGen/builtins-mips-msa.c, covering the new extended 
range for ldi.b.


https://reviews.llvm.org/D31082

Files:
  lib/Sema/SemaChecking.cpp
  test/CodeGen/builtins-mips-msa-error.c
  test/CodeGen/builtins-mips-msa.c


Index: test/CodeGen/builtins-mips-msa.c
===
--- test/CodeGen/builtins-mips-msa.c
+++ test/CodeGen/builtins-mips-msa.c
@@ -526,6 +526,8 @@
   v2i64_r = __msa_ld_d(&v2i64_a, 96); // CHECK: call <2  x i64> 
@llvm.mips.ld.d(
 
   v16i8_r = __msa_ldi_b(3); // CHECK: call <16 x i8>  @llvm.mips.ldi.b(
+  v16i8_r = __msa_ldi_b(-128); // CHECK: call <16 x i8>  @llvm.mips.ldi.b(
+  v16i8_r = __msa_ldi_b(255); // CHECK: call <16 x i8>  @llvm.mips.ldi.b(
   v8i16_r = __msa_ldi_h(3); // CHECK: call <8  x i16> @llvm.mips.ldi.h(
   v4i32_r = __msa_ldi_w(3); // CHECK: call <4  x i32> @llvm.mips.ldi.w(
   v2i64_r = __msa_ldi_d(3); // CHECK: call <2  x i64> @llvm.mips.ldi.d(
Index: test/CodeGen/builtins-mips-msa-error.c
===
--- test/CodeGen/builtins-mips-msa-error.c
+++ test/CodeGen/builtins-mips-msa-error.c
@@ -119,7 +119,7 @@
   v4i32_r = __msa_ld_w(&v4i32_a, 512);   // expected-error 
{{argument should be a value from -512 to 511}}
   v2i64_r = __msa_ld_d(&v2i64_a, 512);   // expected-error 
{{argument should be a value from -512 to 511}}
 
-  v16i8_r = __msa_ldi_b(512);// expected-error 
{{argument should be a value from -512 to 511}}
+  v16i8_r = __msa_ldi_b(256);// expected-error 
{{argument should be a value from -128 to 255}}
   v8i16_r = __msa_ldi_h(512);// expected-error 
{{argument should be a value from -512 to 511}}
   v4i32_r = __msa_ldi_w(512);// expected-error 
{{argument should be a value from -512 to 511}}
   v2i64_r = __msa_ldi_d(512);// expected-error 
{{argument should be a value from -512 to 511}}
@@ -310,7 +310,7 @@
   v4i32_r = __msa_ld_w(&v4i32_a, -513);  // expected-error 
{{argument should be a value from -512 to 511}}
   v2i64_r = __msa_ld_d(&v2i64_a, -513);  // expected-error 
{{argument should be a value from -512 to 511}}
 
-  v16i8_r = __msa_ldi_b(-513);   // expected-error 
{{argument should be a value from -512 to 511}}
+  v16i8_r = __msa_ldi_b(-129);   // expected-error 
{{argument should be a value from -128 to 255}}
   v8i16_r = __msa_ldi_h(-513);   // expected-error 
{{argument should be a value from -512 to 511}}
   v4i32_r = __msa_ldi_w(-513);   // expected-error 
{{argument should be a value from -512 to 511}}
   v2i64_r = __msa_ldi_d(-513);   // expected-error 
{{argument should be a value from -512 to 511}}
Index: lib/Sema/SemaChecking.cpp
===
--- lib/Sema/SemaChecking.cpp
+++ lib/Sema/SemaChecking.cpp
@@ -1640,7 +1640,7 @@
   case Mips::BI__builtin_msa_sldi_d: i = 2; l = 0; u = 1; break;
   // Memory offsets and immediate loads.
   // These intrinsics take a signed 10 bit immediate.
-  case Mips::BI__builtin_msa_ldi_b: i = 0; l = -128; u = 127; break;
+  case Mips::BI__builtin_msa_ldi_b: i = 0; l = -128; u = 255; break;
   case Mips::BI__builtin_msa_ldi_h:
   case Mips::BI__builtin_msa_ldi_w:
   case Mips::BI__builtin_msa_ldi_d: i = 0; l = -512; u = 511; break;


Index: test/CodeGen/builtins-mips-msa.c
===
--- test/CodeGen/builtins-mips-msa.c
+++ test/CodeGen/builtins-mips-msa.c
@@ -526,6 +526,8 @@
   v2i64_r = __msa_ld_d(&v2i64_a, 96); // CHECK: call <2  x i64> @llvm.mips.ld.d(
 
   v16i8_r = __msa_ldi_b(3); // CHECK: call <16 x i8>  @llvm.mips.ldi.b(
+  v16i8_r = __msa_ldi_b(-128); // CHECK: call <16 x i8>  @llvm.mips.ldi.b(
+  v16i8_r = __msa_ldi_b(255); // CHECK: call <16 x i8>  @llvm.mips.ldi.b(
   v8i16_r = __msa_ldi_h(3); // CHECK: call <8  x i16> @llvm.mips.ldi.h(
   v4i32_r = __msa_ldi_w(3); // CHECK: call <4  x i32> @llvm.mips.ldi.w(
   v2i64_r = __msa_ldi_d(3); // CHECK: call <2  x i64> @llvm.mips.ldi.d(
Index: test/CodeGen/builtins-mips-msa-error.c
===
--- test/CodeGen/builtins-mips-msa-error.c
+++ test/CodeGen/builtins-mips-msa-error.c
@@ -119,7 +119,7 @@
   v4i32_r = __msa_ld_w(&v4i32_a, 512);   // expected-error {{argument should be a value from -512 to 511}}
   v2i64_r = __msa_ld_d(&v2i64_a, 512);   // expected-error {{argument should be a value from -512 to 511}}
 
-  v16i8_r = __msa_ldi_b(512);// expected-error {{argument should be a value from -512 to 511}}
+  v16i8_r = __msa_ldi_b(256);// expect

[PATCH] D30810: Preserve vec3 type.

2017-03-21 Thread JinGu Kang via Phabricator via cfe-commits
jaykang10 added a comment.

In https://reviews.llvm.org/D30810#702637, @jaykang10 wrote:

> In https://reviews.llvm.org/D30810#702614, @Anastasia wrote:
>
> > In https://reviews.llvm.org/D30810#702443, @bruno wrote:
> >
> > > > As a result, I think it would be good for clang to have both of 
> > > > features and I would like to stick to the option "-fpresereve-vec3' to 
> > > > change the behavior easily.
> > >
> > > The motivation doesn't seem solid to me, who else is going to benefit 
> > > from this flag?
> >
> >
> > There are some off the main tree implementation that would benefit. But in 
> > the case of AMD GPU 3 loads/stores will be produced instead of 4. Sounds 
> > like a good optimization to me. As I said in my previous comment I think it 
> > should have been the default behavior from the beginning, but since 
> > different implementation landed first we can integrate this one now with an 
> > additional option.
>
>
> Additionally, Here is assembly output from vec3 with amdgcn target. :)
>
> LLVM IR
>
>   define void @foo(<3 x float>* nocapture %a, <3 x float>* nocapture readonly 
> %b) {
>   entry:
> %0 = load <3 x float>, <3 x float>* %b, align 16
> store <3 x float> %0, <3 x float>* %a, align 16
> ret void
>   }
>
>
> Assembly Output
>
>   .text
>   .section.AMDGPU.config
>   .long   47176
>   .long   11272256
>   .long   47180
>   .long   132
>   .long   47200
>   .long   0
>   .long   4
>   .long   0
>   .long   8
>   .long   0
>   .text
>   .globl  foo
>   .p2align8
>   .type   foo,@function
>   foo:; @foo
>   ; BB#0: ; %entry
>   s_load_dword s2, s[0:1], 0x9
>   s_load_dword s0, s[0:1], 0xa
>   s_mov_b32 s4, SCRATCH_RSRC_DWORD0
>   s_mov_b32 s5, SCRATCH_RSRC_DWORD1
>   s_mov_b32 s6, -1
>   s_mov_b32 s8, s3
>   s_mov_b32 s7, 0xe8f000
>   s_waitcnt lgkmcnt(0)
>   v_mov_b32_e32 v0, s0
>   buffer_load_dword v2, v0, s[4:7], s8 offen
>   buffer_load_dword v3, v0, s[4:7], s8 offen offset:8
>   buffer_load_dword v0, v0, s[4:7], s8 offen offset:4
>   v_mov_b32_e32 v1, s2
>   s_waitcnt vmcnt(0)
>   buffer_store_dword v0, v1, s[4:7], s8 offen offset:4
>   buffer_store_dword v2, v1, s[4:7], s8 offen
>   buffer_store_dword v3, v1, s[4:7], s8 offen offset:8
>   s_endpgm
>   .Lfunc_end0:
>   .size   foo, .Lfunc_end0-foo
>  
>   .section.AMDGPU.csdata
>   ; Kernel info:
>   ; codeLenInByte = 112
>   ; NumSgprs: 9
>   ; NumVgprs: 4
>   ; FloatMode: 192
>   ; IeeeMode: 1
>   ; ScratchSize: 0
>   ; LDSByteSize: 0 bytes/workgroup (compile time only)
>   ; SGPRBlocks: 1
>   ; VGPRBlocks: 0
>   ; NumSGPRsForWavesPerEU: 9
>   ; NumVGPRsForWavesPerEU: 4
>   ; ReservedVGPRFirst: 0
>   ; ReservedVGPRCount: 0
>   ; COMPUTE_PGM_RSRC2:USER_SGPR: 2
>   ; COMPUTE_PGM_RSRC2:TRAP_HANDLER: 0
>   ; COMPUTE_PGM_RSRC2:TGID_X_EN: 1
>   ; COMPUTE_PGM_RSRC2:TGID_Y_EN: 0
>   ; COMPUTE_PGM_RSRC2:TGID_Z_EN: 0
>   ; COMPUTE_PGM_RSRC2:TIDIG_COMP_CNT: 0
>  
>   .section".note.GNU-stack"
>


Hi Anastasia, Bruno,

Do you still have other opinion? or Can we go ahead and commit this patch?


https://reviews.llvm.org/D30810



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


[PATCH] D31177: [ARC][ObjC++] Use ObjC semantic rules for comparisons between a pointer and objective-c object pointer

2017-03-21 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman created this revision.

When ARC is enabled in Objective-C++, comparisons between a pointer and 
Objective-C object pointer typically result in errors like this: `invalid 
operands to a binary expression`. This error message can be quite confusing as 
it doesn't provide a solution to the problem, unlike the non-C++ diagnostic: 
`implicit conversion of Objective-C pointer type 'id' to C pointer type 'void 
*' requires a bridged cast` (it also provides fix-its). This patch forces 
comparisons between pointers and objective-c object pointers in ARC to use the 
Objective-C semantic rules to ensure that a better diagnostic is reported.


Repository:
  rL LLVM

https://reviews.llvm.org/D31177

Files:
  lib/Sema/SemaExpr.cpp
  test/SemaObjCXX/arc-ptr-comparison.mm


Index: test/SemaObjCXX/arc-ptr-comparison.mm
===
--- /dev/null
+++ test/SemaObjCXX/arc-ptr-comparison.mm
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-darwin11 -fsyntax-only 
-fobjc-arc -verify %s
+// RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-darwin11 -fsyntax-only 
-verify -DNOARC %s
+#ifdef NOARC
+// expected-no-diagnostics
+#endif
+
+int testObjCComparisonRules(void *v, id x, id y) {
+  return v == x;
+#ifndef NOARC
+// expected-error@-2 {{implicit conversion of Objective-C pointer type 'id' to 
C pointer type 'void *' requires a bridged cast}}
+// expected-note@-3 {{use __bridge to convert directly (no change in 
ownership)}}
+// expected-note@-4 {{use __bridge_retained to make an ARC object available as 
a +1 'void *'}}
+#endif
+  return v >= x;
+#ifndef NOARC
+// expected-error@-2 {{implicit conversion of Objective-C pointer type 'id' to 
C pointer type 'void *' requires a bridged cast}}
+// expected-note@-3 {{use __bridge to convert directly (no change in 
ownership)}}
+// expected-note@-4 {{use __bridge_retained to make an ARC object available as 
a +1 'void *'}}
+#endif
+  return v == (id)(void *)0; // OK
+  return v == nullptr; // OK
+  return v == (void *)0;
+  return x == y;
+}
Index: lib/Sema/SemaExpr.cpp
===
--- lib/Sema/SemaExpr.cpp
+++ lib/Sema/SemaExpr.cpp
@@ -9424,7 +9424,11 @@
 //   If both operands are pointers, [...] bring them to their composite
 //   pointer type.
 if ((int)LHSType->isPointerType() + (int)RHSType->isPointerType() >=
-(IsRelational ? 2 : 1)) {
+(IsRelational || (LangOpts.ObjCAutoRefCount &&
+  (LHSType->isObjCObjectPointerType() ||
+   RHSType->isObjCObjectPointerType()))
+ ? 2
+ : 1)) {
   if (convertPointersToCompositeType(*this, Loc, LHS, RHS))
 return QualType();
   else


Index: test/SemaObjCXX/arc-ptr-comparison.mm
===
--- /dev/null
+++ test/SemaObjCXX/arc-ptr-comparison.mm
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-darwin11 -fsyntax-only -fobjc-arc -verify %s
+// RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-darwin11 -fsyntax-only -verify -DNOARC %s
+#ifdef NOARC
+// expected-no-diagnostics
+#endif
+
+int testObjCComparisonRules(void *v, id x, id y) {
+  return v == x;
+#ifndef NOARC
+// expected-error@-2 {{implicit conversion of Objective-C pointer type 'id' to C pointer type 'void *' requires a bridged cast}}
+// expected-note@-3 {{use __bridge to convert directly (no change in ownership)}}
+// expected-note@-4 {{use __bridge_retained to make an ARC object available as a +1 'void *'}}
+#endif
+  return v >= x;
+#ifndef NOARC
+// expected-error@-2 {{implicit conversion of Objective-C pointer type 'id' to C pointer type 'void *' requires a bridged cast}}
+// expected-note@-3 {{use __bridge to convert directly (no change in ownership)}}
+// expected-note@-4 {{use __bridge_retained to make an ARC object available as a +1 'void *'}}
+#endif
+  return v == (id)(void *)0; // OK
+  return v == nullptr; // OK
+  return v == (void *)0;
+  return x == y;
+}
Index: lib/Sema/SemaExpr.cpp
===
--- lib/Sema/SemaExpr.cpp
+++ lib/Sema/SemaExpr.cpp
@@ -9424,7 +9424,11 @@
 //   If both operands are pointers, [...] bring them to their composite
 //   pointer type.
 if ((int)LHSType->isPointerType() + (int)RHSType->isPointerType() >=
-(IsRelational ? 2 : 1)) {
+(IsRelational || (LangOpts.ObjCAutoRefCount &&
+  (LHSType->isObjCObjectPointerType() ||
+   RHSType->isObjCObjectPointerType()))
+ ? 2
+ : 1)) {
   if (convertPointersToCompositeType(*this, Loc, LHS, RHS))
 return QualType();
   else
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D31178: [libcxxabi] Fix exception address alignment test for EHABI

2017-03-21 Thread Asiri Rathnayake via Phabricator via cfe-commits
rmaprath created this revision.
Herald added a subscriber: aemerson.

This test was failing on our downstream (bare-metal) runs and only now I got 
around to investigate it.

The problem is, this test assumes the Itanium ABI, whereas EHABI requires the 
exception address to be 8-byte aligned.

I was a bit puzzled at first because this should've failed on the public 
arm-linux builder too. I think the reason it passes there is because we don't 
include libunwind headers in the include path when running the libcxxabi tests, 
so the system `unwind.h` gets picked up.


https://reviews.llvm.org/D31178

Files:
  test/libcxxabi/test/config.py
  test/lit.site.cfg.in
  test/test_exception_address_alignment.pass.cpp


Index: test/test_exception_address_alignment.pass.cpp
===
--- test/test_exception_address_alignment.pass.cpp
+++ test/test_exception_address_alignment.pass.cpp
@@ -15,16 +15,25 @@
 // working around this failure.
 // XFAIL: darwin && libcxxabi-has-system-unwinder
 
-// Test that the address of the exception object is properly aligned to the
-// largest supported alignment for the system.
+// Test that the address of the exception object is properly aligned as 
required
+// by the relevant ABI
 
 #include 
 #include 
 
 #include 
 
 struct __attribute__((aligned)) AlignedType {};
-static_assert(alignof(AlignedType) == alignof(_Unwind_Exception),
+
+// EHABI  : 8-byte aligned
+// Itanium: Largest supported alignment for the system
+#if _LIBUNWIND_ARM_EHABI
+#  define EXPECTED_ALIGNMENT 8
+#else
+#  define EXPECTED_ALIGNMENT alignof(AlignedType)
+#endif
+
+static_assert(alignof(_Unwind_Exception) == EXPECTED_ALIGNMENT,
   "_Unwind_Exception is incorrectly aligned. This test is expected to fail");
 
 struct MinAligned {  };
@@ -35,7 +44,7 @@
 try {
   throw MinAligned{};
 } catch (MinAligned const& ref) {
-  assert(reinterpret_cast(&ref) % alignof(AlignedType) == 0);
+  assert(reinterpret_cast(&ref) % EXPECTED_ALIGNMENT == 0);
 }
   }
 }
Index: test/lit.site.cfg.in
===
--- test/lit.site.cfg.in
+++ test/lit.site.cfg.in
@@ -6,6 +6,8 @@
 config.abi_library_path = "@LIBCXXABI_LIBRARY_DIR@"
 config.libcxx_src_root  = "@LIBCXXABI_LIBCXX_PATH@"
 config.cxx_headers  = "@LIBCXXABI_LIBCXX_INCLUDES@"
+config.libunwind_src= "@LIBCXXABI_LIBUNWIND_SOURCES@"
+config.libunwind_headers= "@LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL@"
 config.cxx_library_root = "@LIBCXXABI_LIBCXX_LIBRARY_PATH@"
 config.llvm_unwinder= "@LIBCXXABI_USE_LLVM_UNWINDER@"
 config.enable_threads   = "@LIBCXXABI_ENABLE_THREADS@"
Index: test/libcxxabi/test/config.py
===
--- test/libcxxabi/test/config.py
+++ test/libcxxabi/test/config.py
@@ -20,14 +20,18 @@
 self.libcxxabi_obj_root = None
 self.abi_library_path = None
 self.libcxx_src_root = None
+self.libunwind_src_root = None
 
 def configure_src_root(self):
 self.libcxxabi_src_root = self.get_lit_conf(
 'libcxxabi_src_root',
 os.path.dirname(self.config.test_source_root))
 self.libcxx_src_root = self.get_lit_conf(
 'libcxx_src_root',
 os.path.join(self.libcxxabi_src_root, '/../libcxx'))
+self.libunwind_src_root = self.get_lit_conf(
+'libunwind_src_root',
+os.path.join(self.libcxxabi_src_root, '/../libunwind'))
 
 def configure_obj_root(self):
 self.libcxxabi_obj_root = self.get_lit_conf('libcxxabi_obj_root')
@@ -84,6 +88,15 @@
   % libcxxabi_headers)
 self.cxx.compile_flags += ['-I' + libcxxabi_headers]
 
+libunwind_headers = self.get_lit_conf(
+   'libunwind_headers',
+   os.path.join(self.libunwind_src_root, 'include'))
+if self.get_lit_bool('llvm_unwinder', False):
+if not os.path.isdir(libunwind_headers):
+self.lit_config.fatal("libunwind_headers='%s' is not a 
directory."
+  % libunwind_headers)
+self.cxx.compile_flags += ['-I' + libunwind_headers]
+
 def configure_compile_flags_exceptions(self):
 pass
 


Index: test/test_exception_address_alignment.pass.cpp
===
--- test/test_exception_address_alignment.pass.cpp
+++ test/test_exception_address_alignment.pass.cpp
@@ -15,16 +15,25 @@
 // working around this failure.
 // XFAIL: darwin && libcxxabi-has-system-unwinder
 
-// Test that the address of the exception object is properly aligned to the
-// largest supported alignment for the system.
+// Test that the address of the exception object is properly aligned as required
+// by the relevant ABI
 
 #include 
 #include 
 
 #include 
 
 struct __attribute_

r298355 - [scan-build-py] reuse command line output parameter for report directory

2017-03-21 Thread Laszlo Nagy via cfe-commits
Author: rizsotto
Date: Tue Mar 21 05:15:18 2017
New Revision: 298355

URL: http://llvm.org/viewvc/llvm-project?rev=298355&view=rev
Log:
[scan-build-py] reuse command line output parameter for report directory

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

Modified:
cfe/trunk/tools/scan-build-py/libscanbuild/analyze.py
cfe/trunk/tools/scan-build-py/libscanbuild/report.py

Modified: cfe/trunk/tools/scan-build-py/libscanbuild/analyze.py
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-build-py/libscanbuild/analyze.py?rev=298355&r1=298354&r2=298355&view=diff
==
--- cfe/trunk/tools/scan-build-py/libscanbuild/analyze.py (original)
+++ cfe/trunk/tools/scan-build-py/libscanbuild/analyze.py Tue Mar 21 05:15:18 
2017
@@ -40,7 +40,8 @@ def scan_build():
 """ Entry point for scan-build command. """
 
 args = parse_args_for_scan_build()
-with report_directory(args.output, args.keep_empty) as target_dir:
+# will re-assign the report directory as new output
+with report_directory(args.output, args.keep_empty) as args.output:
 # Run against a build command. there are cases, when analyzer run
 # is not required. But we need to set up everything for the
 # wrappers, because 'configure' needs to capture the CC/CXX values
@@ -50,13 +51,13 @@ def scan_build():
 exit_code = capture(args)
 # Run the analyzer against the captured commands.
 if need_analyzer(args.build):
-run_analyzer(args, target_dir)
+run_analyzer(args)
 else:
 # Run build command and analyzer with compiler wrappers.
-environment = setup_environment(args, target_dir)
+environment = setup_environment(args)
 exit_code = run_build(args.build, env=environment)
 # Cover report generation and bug counting.
-number_of_bugs = document(args, target_dir, False)
+number_of_bugs = document(args)
 # Set exit status as it was requested.
 return number_of_bugs if args.status_bugs else exit_code
 
@@ -66,11 +67,12 @@ def analyze_build():
 """ Entry point for analyze-build command. """
 
 args = parse_args_for_analyze_build()
-with report_directory(args.output, args.keep_empty) as target_dir:
+# will re-assign the report directory as new output
+with report_directory(args.output, args.keep_empty) as args.output:
 # Run the analyzer against a compilation db.
-run_analyzer(args, target_dir)
+run_analyzer(args)
 # Cover report generation and bug counting.
-number_of_bugs = document(args, target_dir, True)
+number_of_bugs = document(args)
 # Set exit status as it was requested.
 return number_of_bugs if args.status_bugs else 0
 
@@ -88,7 +90,7 @@ def need_analyzer(args):
 return len(args) and not re.search('configure|autogen', args[0])
 
 
-def run_analyzer(args, output_dir):
+def run_analyzer(args):
 """ Runs the analyzer against the given compilation database. """
 
 def exclude(filename):
@@ -98,7 +100,7 @@ def run_analyzer(args, output_dir):
 
 consts = {
 'clang': args.clang,
-'output_dir': output_dir,
+'output_dir': args.output,
 'output_format': args.output_format,
 'output_failures': args.output_failures,
 'direct_args': analyzer_params(args),
@@ -120,7 +122,7 @@ def run_analyzer(args, output_dir):
 pool.join()
 
 
-def setup_environment(args, destination):
+def setup_environment(args):
 """ Set up environment for build command to interpose compiler wrapper. """
 
 environment = dict(os.environ)
@@ -129,7 +131,7 @@ def setup_environment(args, destination)
 'CC': COMPILER_WRAPPER_CC,
 'CXX': COMPILER_WRAPPER_CXX,
 'ANALYZE_BUILD_CLANG': args.clang if need_analyzer(args.build) else '',
-'ANALYZE_BUILD_REPORT_DIR': destination,
+'ANALYZE_BUILD_REPORT_DIR': args.output,
 'ANALYZE_BUILD_REPORT_FORMAT': args.output_format,
 'ANALYZE_BUILD_REPORT_FAILURES': 'yes' if args.output_failures else '',
 'ANALYZE_BUILD_PARAMETERS': ' '.join(analyzer_params(args)),

Modified: cfe/trunk/tools/scan-build-py/libscanbuild/report.py
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-build-py/libscanbuild/report.py?rev=298355&r1=298354&r2=298355&view=diff
==
--- cfe/trunk/tools/scan-build-py/libscanbuild/report.py (original)
+++ cfe/trunk/tools/scan-build-py/libscanbuild/report.py Tue Mar 21 05:15:18 
2017
@@ -18,58 +18,60 @@ import plistlib
 import glob
 import json
 import logging
+import datetime
 from libscanbuild import duplicate_check
 from libscanbuild.clang import get_version
 
 __all__ = ['document']
 
 
-def document(args, output_dir, use_cdb):
+def document(args):
 

[PATCH] D31178: [libcxxabi] Fix exception address alignment test for EHABI

2017-03-21 Thread Asiri Rathnayake via Phabricator via cfe-commits
rmaprath updated this revision to Diff 92450.
rmaprath added a comment.

Fixed a few paths.


https://reviews.llvm.org/D31178

Files:
  test/libcxxabi/test/config.py
  test/lit.site.cfg.in
  test/test_exception_address_alignment.pass.cpp


Index: test/test_exception_address_alignment.pass.cpp
===
--- test/test_exception_address_alignment.pass.cpp
+++ test/test_exception_address_alignment.pass.cpp
@@ -15,16 +15,25 @@
 // working around this failure.
 // XFAIL: darwin && libcxxabi-has-system-unwinder
 
-// Test that the address of the exception object is properly aligned to the
-// largest supported alignment for the system.
+// Test that the address of the exception object is properly aligned as 
required
+// by the relevant ABI
 
 #include 
 #include 
 
 #include 
 
 struct __attribute__((aligned)) AlignedType {};
-static_assert(alignof(AlignedType) == alignof(_Unwind_Exception),
+
+// EHABI  : 8-byte aligned
+// Itanium: Largest supported alignment for the system
+#if _LIBUNWIND_ARM_EHABI
+#  define EXPECTED_ALIGNMENT 8
+#else
+#  define EXPECTED_ALIGNMENT alignof(AlignedType)
+#endif
+
+static_assert(alignof(_Unwind_Exception) == EXPECTED_ALIGNMENT,
   "_Unwind_Exception is incorrectly aligned. This test is expected to fail");
 
 struct MinAligned {  };
@@ -35,7 +44,7 @@
 try {
   throw MinAligned{};
 } catch (MinAligned const& ref) {
-  assert(reinterpret_cast(&ref) % alignof(AlignedType) == 0);
+  assert(reinterpret_cast(&ref) % EXPECTED_ALIGNMENT == 0);
 }
   }
 }
Index: test/lit.site.cfg.in
===
--- test/lit.site.cfg.in
+++ test/lit.site.cfg.in
@@ -6,6 +6,8 @@
 config.abi_library_path = "@LIBCXXABI_LIBRARY_DIR@"
 config.libcxx_src_root  = "@LIBCXXABI_LIBCXX_PATH@"
 config.cxx_headers  = "@LIBCXXABI_LIBCXX_INCLUDES@"
+config.libunwind_src= "@LIBCXXABI_LIBUNWIND_SOURCES@"
+config.libunwind_headers= "@LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL@"
 config.cxx_library_root = "@LIBCXXABI_LIBCXX_LIBRARY_PATH@"
 config.llvm_unwinder= "@LIBCXXABI_USE_LLVM_UNWINDER@"
 config.enable_threads   = "@LIBCXXABI_ENABLE_THREADS@"
Index: test/libcxxabi/test/config.py
===
--- test/libcxxabi/test/config.py
+++ test/libcxxabi/test/config.py
@@ -20,14 +20,18 @@
 self.libcxxabi_obj_root = None
 self.abi_library_path = None
 self.libcxx_src_root = None
+self.libunwind_src = None
 
 def configure_src_root(self):
 self.libcxxabi_src_root = self.get_lit_conf(
 'libcxxabi_src_root',
 os.path.dirname(self.config.test_source_root))
 self.libcxx_src_root = self.get_lit_conf(
 'libcxx_src_root',
 os.path.join(self.libcxxabi_src_root, '/../libcxx'))
+self.libunwind_src = self.get_lit_conf(
+'libunwind_src',
+os.path.join(self.libcxxabi_src_root, '/../libunwind/src'))
 
 def configure_obj_root(self):
 self.libcxxabi_obj_root = self.get_lit_conf('libcxxabi_obj_root')
@@ -84,6 +88,15 @@
   % libcxxabi_headers)
 self.cxx.compile_flags += ['-I' + libcxxabi_headers]
 
+libunwind_headers = self.get_lit_conf(
+   'libunwind_headers',
+   os.path.join(self.libunwind_src, '/../include'))
+if self.get_lit_bool('llvm_unwinder', False):
+if not os.path.isdir(libunwind_headers):
+self.lit_config.fatal("libunwind_headers='%s' is not a 
directory."
+  % libunwind_headers)
+self.cxx.compile_flags += ['-I' + libunwind_headers]
+
 def configure_compile_flags_exceptions(self):
 pass
 


Index: test/test_exception_address_alignment.pass.cpp
===
--- test/test_exception_address_alignment.pass.cpp
+++ test/test_exception_address_alignment.pass.cpp
@@ -15,16 +15,25 @@
 // working around this failure.
 // XFAIL: darwin && libcxxabi-has-system-unwinder
 
-// Test that the address of the exception object is properly aligned to the
-// largest supported alignment for the system.
+// Test that the address of the exception object is properly aligned as required
+// by the relevant ABI
 
 #include 
 #include 
 
 #include 
 
 struct __attribute__((aligned)) AlignedType {};
-static_assert(alignof(AlignedType) == alignof(_Unwind_Exception),
+
+// EHABI  : 8-byte aligned
+// Itanium: Largest supported alignment for the system
+#if _LIBUNWIND_ARM_EHABI
+#  define EXPECTED_ALIGNMENT 8
+#else
+#  define EXPECTED_ALIGNMENT alignof(AlignedType)
+#endif
+
+static_assert(alignof(_Unwind_Exception) == EXPECTED_ALIGNMENT,
   "_Unwind_Exception is incorrectly aligned. This test is expected to fail");
 
 struct MinAligned {  };
@@ -35,7 +4

[PATCH] D30493: [change-namespace] avoid adding leading '::' when possible.

2017-03-21 Thread Eric Liu via Phabricator via cfe-commits
ioeric added a comment.

Ping ;)


https://reviews.llvm.org/D30493



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


[PATCH] D30777: Added `applyAtomicChanges` function.

2017-03-21 Thread Eric Liu via Phabricator via cfe-commits
ioeric added a comment.

Ping ;)


https://reviews.llvm.org/D30777



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


[PATCH] D31178: [libcxxabi] Fix exception address alignment test for EHABI

2017-03-21 Thread Renato Golin via Phabricator via cfe-commits
rengolin added a comment.

This looks like a simple oversight from my perspective, so looks good.

But I'll let the others have a look at it, as I'm not overly familiar with 
libcxxabi.

cheers,
--renato


https://reviews.llvm.org/D31178



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


[PATCH] D30009: Add support for '#pragma clang attribute'

2017-03-21 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman added a comment.

In https://reviews.llvm.org/D30009#705699, @aaron.ballman wrote:

> In https://reviews.llvm.org/D30009#705649, @efriedma wrote:
>
> > Looking over the most recent version, I'm happy with the general semantics 
> > of push with apply_only_to.  I'm not sure I see the point of apply_to: it 
> > doesn't allow the user to do anything that can't be done with 
> > apply_only_to.  Also, if the apply_to list for an attribute ever changes, 
> > it becomes impossible to write code which supports both versions of the 
> > compiler.
>


This is a good point that I haven't considered.

> You bring up a really good point about compiler versioning -- it would be 
> pretty awful to force the user to use #ifs to deal with that.
> 
> I believe apply_to is somewhat useful so that the user knows what an 
> attribute actually appertains to, and get a diagnostic if we ever extend the 
> list of things their particular attribute can appertain to so they are forced 
> to decide whether they want that new behavior or not.
> 
> @arphaman, what do you think about the idea of only having apply_to with the 
> same semantics as you currently have for apply_only_to?

I would be ok with that. We could merge `apply_to` and `apply_only_to` into a 
single `apply_to` matching rule set specifier (it would behave like 
`apply_only_to`).

I guess one downside would be is that it will become harder to fill out all the 
match rules if one wants to apply an attribute to all possible declarations. I 
suppose the attribute documentation generator can be updated to include the 
full match rule set for each attribute instead of just yes/no in the `#pragma 
clang attribute` documentation column.


Repository:
  rL LLVM

https://reviews.llvm.org/D30009



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


[PATCH] D31176: [clang-rename] Support renaming qualified symbol

2017-03-21 Thread Eric Liu via Phabricator via cfe-commits
ioeric added a comment.

I think this is a great start!

First round with some nits.




Comment at: clang-rename/RenamingAction.cpp:87
 
+class QualifiedRenamingASTConsumer : public ASTConsumer {
+public:

Comments. 



Comment at: clang-rename/RenamingAction.h:45
 
+class QualifiedRenamingAction {
+public:

Comments. Same for other classes.



Comment at: clang-rename/RenamingAction.h:60
+  const std::vector &OldNames;
+  const std::vector> &USRList;
+  std::map &FileToReplaces;

What is `USRList`? 



Comment at: clang-rename/USRFinder.cpp:139
+  if (Name != Decl->getQualifiedNameAsString() &&
+  Name != "::" + Decl->getQualifiedNameAsString()) {
 return true;

nit: No braces for one-liners.



Comment at: clang-rename/USRFinder.cpp:200
 
+  // Also find all USRs of nested declarations.
+  NestedNameSpecifierLocFinder Finder(const_cast(Context));

It is unclear to me what `nested declarations` are.



Comment at: clang-rename/USRLocFinder.cpp:152
 
+clang::SourceLocation StartLocationForType(clang::TypeLoc TL) {
+  // For elaborated types (e.g. `struct a::A`) we want the portion after the

You don't need "clang::" here and elsewhere. 



Comment at: clang-rename/USRLocFinder.cpp:156
+  if (TL.getTypeLocClass() == clang::TypeLoc::Elaborated) {
+clang::NestedNameSpecifierLoc nested_name_specifier =
+TL.castAs().getQualifierLoc();

Variable names should be LLVM style.



Comment at: clang-rename/USRLocFinder.cpp:157
+clang::NestedNameSpecifierLoc nested_name_specifier =
+TL.castAs().getQualifierLoc();
+if (nested_name_specifier.getNestedNameSpecifier())

Is this cast always safe? 



Comment at: clang-rename/USRLocFinder.cpp:169
+ TL.getTypeLocClass() == clang::TypeLoc::Qualified) {
+TL = TL.getNextTypeLoc();
+  }

nit: No braces around one-liners. Same below.



Comment at: clang-rename/USRLocFinder.cpp:196
+
+class RenameLocFindingASTVisitor
+: public clang::RecursiveASTVisitor {

Comments.



Comment at: clang-rename/USRLocFinder.cpp:196
+
+class RenameLocFindingASTVisitor
+: public clang::RecursiveASTVisitor {

ioeric wrote:
> Comments.
I think this visitor deserves a file of its own.



Comment at: clang-rename/USRLocFinder.cpp:368
+private:
+  bool IsTypeAliasWhichWillBeRenamedElsewhere(TypeLoc TL) const {
+while (!TL.isNull()) {

Note this is not expected behavior for alias types which would always be 
skipped in this check.



Comment at: clang-rename/USRLocFinder.cpp:466
+
+  for (const auto &Loc : Finder.getRenameInfos()) {
+std::string ReplacedName = NewName.str();

`Loc` seems to be a bad name here. It is usually used for TypeLoc.



Comment at: clang-rename/USRLocFinder.h:34
+std::vector
+getQualifiedRenameLocsOfUSRs(llvm::ArrayRef USRs,
+ llvm::StringRef OldName, llvm::StringRef NewName,

Comments.


https://reviews.llvm.org/D31176



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


[PATCH] D31179: Objective-C categ

2017-03-21 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman created this revision.

Repository:
  rL LLVM

https://reviews.llvm.org/D31179

Files:
  include/clang/Basic/DiagnosticParseKinds.td
  include/clang/Sema/Sema.h
  lib/Parse/ParseObjc.cpp
  lib/Sema/SemaDeclObjC.cpp
  test/SemaObjC/attr-deprecated.m
  test/SemaObjC/category-attribute.m
  test/SemaObjC/default-synthesize-3.m

Index: test/SemaObjC/default-synthesize-3.m
===
--- test/SemaObjC/default-synthesize-3.m
+++ test/SemaObjC/default-synthesize-3.m
@@ -33,8 +33,8 @@
 - (id) DeepMustSynthProperty { return 0; }
 @end
 
-__attribute ((objc_requires_property_definitions)) 
-@interface Deep(CAT)  // expected-error {{attributes may not be specified on a category}}
+__attribute ((objc_requires_property_definitions)) // expected-error {{'objc_requires_property_definitions' attribute only applies to Objective-C interfaces}}
+@interface Deep(CAT)
 @end
 
 __attribute ((objc_requires_property_definitions)) // expected-error {{'objc_requires_property_definitions' attribute only applies to Objective-C interfaces}}
Index: test/SemaObjC/category-attribute.m
===
--- /dev/null
+++ test/SemaObjC/category-attribute.m
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -ast-dump %s | FileCheck %s
+// expected-no-diagnostics
+
+__attribute__ ((external_source_symbol(language= "Swift", defined_in="A")))
+@interface TestInterface
+@end
+// CHECK: ObjCInterfaceDecl {{.*}} TestInterface
+// CHECK-NEXT: ExternalSourceSymbolAttr
+
+__attribute__ ((external_source_symbol(language= "Swift", defined_in="B")))
+@interface TestInterface ()
+@end
+// CHECK: ObjCCategoryDecl
+// CHECK-NEXT: ObjCInterface
+// CHECK-NEXT: ExternalSourceSymbolAttr {{.*}} "Swift" "B"
+
+__attribute__ ((external_source_symbol(language= "Swift", defined_in="C")))
+@interface TestInterface (Category)
+@end
+// CHECK: ObjCCategoryDecl
+// CHECK-NEXT: ObjCInterface
+// CHECK-NEXT: ExternalSourceSymbolAttr {{.*}} "Swift" "C"
+
Index: test/SemaObjC/attr-deprecated.m
===
--- test/SemaObjC/attr-deprecated.m
+++ test/SemaObjC/attr-deprecated.m
@@ -121,9 +121,15 @@
 }
 
 __attribute__((deprecated))
-@interface A(Blah) // expected-error{{attributes may not be specified on a category}}
+@interface A(Blah) // no warning
+- (A*)getA;
 @end
 
+@implementation A(Blah) // no warning
+- (A*)getA {
+  return self;
+}
+@end
 
 typedef struct {
 	int x;
Index: lib/Sema/SemaDeclObjC.cpp
===
--- lib/Sema/SemaDeclObjC.cpp
+++ lib/Sema/SemaDeclObjC.cpp
@@ -1724,7 +1724,8 @@
 Decl * const *ProtoRefs,
 unsigned NumProtoRefs,
 const SourceLocation *ProtoLocs,
-SourceLocation EndProtoLoc) {
+SourceLocation EndProtoLoc,
+AttributeList *AttrList) {
   ObjCCategoryDecl *CDecl;
   ObjCInterfaceDecl *IDecl = getObjCInterfaceDecl(ClassName, ClassLoc, true);
 
@@ -1801,6 +1802,9 @@
 NumProtoRefs, Context); 
   }
 
+  if (AttrList)
+ProcessDeclAttributeList(TUScope, CDecl, AttrList);
+
   CheckObjCDeclScope(CDecl);
   return ActOnObjCContainerStartDefinition(CDecl);
 }
Index: lib/Parse/ParseObjc.cpp
===
--- lib/Parse/ParseObjc.cpp
+++ lib/Parse/ParseObjc.cpp
@@ -278,11 +278,6 @@
 T.consumeClose();
 if (T.getCloseLocation().isInvalid())
   return nullptr;
-
-if (!attrs.empty()) { // categories don't support attributes.
-  Diag(nameLoc, diag::err_objc_no_attributes_on_category);
-  attrs.clear();
-}
 
 // Next, we need to check for any protocol references.
 assert(LAngleLoc.isInvalid() && "Cannot have already parsed protocols");
@@ -294,16 +289,11 @@
 /*consumeLastToken=*/true))
   return nullptr;
 
-Decl *CategoryType =
-Actions.ActOnStartCategoryInterface(AtLoc,
-nameId, nameLoc,
-typeParameterList,
-categoryId, categoryLoc,
-ProtocolRefs.data(),
-ProtocolRefs.size(),
-ProtocolLocs.data(),
-EndProtoLoc);
-
+Decl *CategoryType = Actions.ActOnStartCategoryInterface(
+AtLoc, nameId, nameLoc, typeParameterList, categoryId, categoryLoc,
+ProtocolRefs.data(), ProtocolRefs.size(), ProtocolLocs.data(),
+EndProtoLoc, attrs.getList());
+
 if (Tok.is(tok::l_brace))
   ParseObjCClassInstanceVariables(CategoryType, tok::objc_priv

[PATCH] D31179: Objective-C categories should support attributes

2017-03-21 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman added a comment.

Sorry about an empty body, I had a keyboard malfunction. I have updated the 
patch now.


Repository:
  rL LLVM

https://reviews.llvm.org/D31179



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


SemaAccess bug (protected members of derived)

2017-03-21 Thread Dixon Ryan (ETAS/ERS-PD2) via cfe-commits
There are a number of users of the clang static analyser back-end for 
intelligent code completion. Irony-Mode for emacs, for example. For a while 
people have been reporting an issue with not getting completions for protected 
members of parent classes and I believe this patch solves the bug: simply that 
the arguments to IsDerivedFromInclusive were the wrong way around.

URL: http://llvm.org/svn/llvm-project/cfe/trunk/lib/Sema
Relative URL: ^/cfe/trunk/lib/Sema

Index: SemaAccess.cpp
===
--- SemaAccess.cpp  (revision 297956)
+++ SemaAccess.cpp   (working copy)
@@ -823,7 +823,7 @@
 continue;
   }
-  switch (IsDerivedFromInclusive(InstanceContext, ECRecord)) {
+  switch (IsDerivedFromInclusive(ECRecord, InstanceContext)) {
   case AR_accessible: return AR_accessible;
   case AR_inaccessible: continue;
   case AR_dependent: OnFailure = AR_dependent; continue;

Thank you.


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


[PATCH] D30493: [change-namespace] avoid adding leading '::' when possible.

2017-03-21 Thread Haojian Wu via Phabricator via cfe-commits
hokein accepted this revision.
hokein added a comment.
This revision is now accepted and ready to land.

Sorry, I missed this patch.

LGTM with one nit.




Comment at: change-namespace/ChangeNamespace.cpp:296
+assert(!NsSplitted.empty());
+for (auto I = NsSplitted.begin() + 1, E = NsSplitted.end(); I != E; ++I) {
+  if (*I == SymbolSplitted.front())

ioeric wrote:
> hokein wrote:
> > Why skipping the first element? And use `is_contained` instead?
> See newly added comments for reasoning.
I see. This sounds the `conflictInNamespace` is too coupled with caller because 
it relies on "it equals to the symbol's outermost namespace and the symbol name 
would have been shortened" assumption. It is not straightforward especially for 
readers who read the code at the first time.  So I'd like to search from 0 (and 
this operation is trivial). 


https://reviews.llvm.org/D30493



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


Re: SemaAccess bug (protected members of derived)

2017-03-21 Thread Alex L via cfe-commits
Hi,

Can you please add a suitable test-case? Clang's code-completion tests are
normally in test/CodeCompletion or test/Index.

Cheers,
Alex

On 21 March 2017 at 12:05, Dixon Ryan (ETAS/ERS-PD2) via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> There are a number of users of the clang static analyser back-end for
> intelligent code completion. Irony-Mode for emacs, for example. For a while
> people have been reporting an issue with not getting completions for
> protected members of parent classes and I believe this patch solves the
> bug: simply that the arguments to IsDerivedFromInclusive were the wrong way
> around.
>
>
>
> URL: http://llvm.org/svn/llvm-project/cfe/trunk/lib/Sema
>
> Relative URL: ^/cfe/trunk/lib/Sema
>
>
>
> Index: SemaAccess.cpp
>
> ===
>
> --- SemaAccess.cpp  (revision 297956)
>
> +++ SemaAccess.cpp   (working copy)
>
> @@ -823,7 +823,7 @@
>
>  continue;
>
>}
>
> -  switch (IsDerivedFromInclusive(InstanceContext, ECRecord)) {
>
> +  switch (IsDerivedFromInclusive(ECRecord, InstanceContext)) {
>
>case AR_accessible: return AR_accessible;
>
>case AR_inaccessible: continue;
>
>case AR_dependent: OnFailure = AR_dependent; continue;
>
>
>
> Thank you.
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D31183: [OpenCL] Added parsing for OpenCL vector types.

2017-03-21 Thread Egor Churaev via Phabricator via cfe-commits
echuraev created this revision.
Herald added a subscriber: yaxunl.

https://reviews.llvm.org/D31183

Files:
  include/clang/Parse/Parser.h
  lib/Parse/ParseExpr.cpp
  test/Parser/vector-cast-define.cl

Index: test/Parser/vector-cast-define.cl
===
--- /dev/null
+++ test/Parser/vector-cast-define.cl
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
+// expected-no-diagnostics
+
+typedef int int3 __attribute__((ext_vector_type(3)));
+
+#define i3(x, y, z) (int3)(x, y, z)
+#define dgSize i3(32+2,32+2,32+2)
+
+void test()
+{
+int index = dgSize.x * dgSize.y;
+}
+
Index: lib/Parse/ParseExpr.cpp
===
--- lib/Parse/ParseExpr.cpp
+++ lib/Parse/ParseExpr.cpp
@@ -473,12 +473,14 @@
 ///
 ExprResult Parser::ParseCastExpression(bool isUnaryExpression,
bool isAddressOfOperand,
-   TypeCastState isTypeCast) {
+   TypeCastState isTypeCast,
+   bool isVectorLiteral) {
   bool NotCastExpr;
   ExprResult Res = ParseCastExpression(isUnaryExpression,
isAddressOfOperand,
NotCastExpr,
-   isTypeCast);
+   isTypeCast,
+   isVectorLiteral);
   if (NotCastExpr)
 Diag(Tok, diag::err_expected_expression);
   return Res;
@@ -694,7 +696,8 @@
 ExprResult Parser::ParseCastExpression(bool isUnaryExpression,
bool isAddressOfOperand,
bool &NotCastExpr,
-   TypeCastState isTypeCast) {
+   TypeCastState isTypeCast,
+   bool isVectorLiteral) {
   ExprResult Res;
   tok::TokenKind SavedKind = Tok.getKind();
   NotCastExpr = false;
@@ -722,6 +725,9 @@
 Res = ParseParenExpression(ParenExprType, false/*stopIfCastExr*/,
isTypeCast == IsTypeCast, CastTy, RParenLoc);
 
+if (isVectorLiteral)
+return Res;
+
 switch (ParenExprType) {
 case SimpleExpr:   break;// Nothing else to do.
 case CompoundStmt: break;  // Nothing else to do.
@@ -2350,6 +2356,48 @@
 return ParseCompoundLiteralExpression(Ty.get(), OpenLoc, RParenLoc);
   }
 
+  if (Tok.is(tok::l_paren)) {
+// This could be OpenCL vector Literals
+if (getLangOpts().OpenCL)
+{
+  TypeResult Ty;
+  {
+InMessageExpressionRAIIObject InMessage(*this, false);
+Ty = Actions.ActOnTypeName(getCurScope(), DeclaratorInfo);
+  }
+  if(Ty.isInvalid())
+  {
+ return ExprError();
+  }
+  QualType QT = Ty.get().get().getCanonicalType();
+  if (QT->isVectorType())
+  {
+// We parsed '(' vector-type-name ')' followed by '('
+
+// Parse the cast-expression that follows it next.
+// isVectorLiteral = true will make sure we don't parse any
+// Postfix expression yet
+Result = ParseCastExpression(/*isUnaryExpression=*/false,
+ /*isAddressOfOperand=*/false,
+ /*isTypeCast=*/IsTypeCast,
+ /*isVectorLiteral=*/true);
+
+if (!Result.isInvalid()) {
+  Result = Actions.ActOnCastExpr(getCurScope(), OpenLoc,
+ DeclaratorInfo, CastTy,
+ RParenLoc, Result.get());
+}
+
+// After we performed the cast we can check for postfix-expr pieces.
+if (!Result.isInvalid()) {
+  Result = ParsePostfixExpressionSuffix(Result);
+}
+
+return Result;
+  }
+}
+  }
+
   if (ExprType == CastExpr) {
 // We parsed '(' type-name ')' and the thing after it wasn't a '{'.
 
@@ -2379,10 +2427,13 @@
 }
 
 // Parse the cast-expression that follows it next.
+// isVectorLiteral = true will make sure we don't parse any
+// Postfix expression yet
 // TODO: For cast expression with CastTy.
 Result = ParseCastExpression(/*isUnaryExpression=*/false,
  /*isAddressOfOperand=*/false,
- /*isTypeCast=*/IsTypeCast);
+ /*isTypeCast=*/IsTypeCast,
+ /*isVectorLiteral=*/true);
 if (!Result.isInvalid()) {
   Result = Actions.ActOnCastExpr(getCurScope(), OpenLoc,
  Declara

[PATCH] D30493: [change-namespace] avoid adding leading '::' when possible.

2017-03-21 Thread Eric Liu via Phabricator via cfe-commits
ioeric added inline comments.



Comment at: change-namespace/ChangeNamespace.cpp:296
+assert(!NsSplitted.empty());
+for (auto I = NsSplitted.begin() + 1, E = NsSplitted.end(); I != E; ++I) {
+  if (*I == SymbolSplitted.front())

hokein wrote:
> ioeric wrote:
> > hokein wrote:
> > > Why skipping the first element? And use `is_contained` instead?
> > See newly added comments for reasoning.
> I see. This sounds the `conflictInNamespace` is too coupled with caller 
> because it relies on "it equals to the symbol's outermost namespace and the 
> symbol name would have been shortened" assumption. It is not straightforward 
> especially for readers who read the code at the first time.  So I'd like to 
> search from 0 (and this operation is trivial). 
This is also for correctness since it is really not a conflict when symbol and 
namespace has the same outer-most namespace. I could've dropped "the symbol 
name would have been shortened" part. 


https://reviews.llvm.org/D30493



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


[PATCH] D30739: [OpenMP] "declare simd" for AArch64 Advanced SIMD.

2017-03-21 Thread Jonas Hahnfeld via Phabricator via cfe-commits
Hahnfeld added a comment.

In principal looks good to me although I'm not really familiar with this part. 
Does that work for you if you have the `declare simd` in a header file and the 
implementation in another file? On x86_64 I currently get:

  remark: loop not vectorized: call instruction cannot be vectorized

But that seems to be a general problem inside LLVM's LoopVectorize pass...


https://reviews.llvm.org/D30739



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


[PATCH] D30493: [change-namespace] avoid adding leading '::' when possible.

2017-03-21 Thread Eric Liu via Phabricator via cfe-commits
ioeric updated this revision to Diff 92475.
ioeric added a comment.

- fixed newly added tests.


https://reviews.llvm.org/D30493

Files:
  change-namespace/ChangeNamespace.cpp
  unittests/change-namespace/ChangeNamespaceTests.cpp

Index: unittests/change-namespace/ChangeNamespaceTests.cpp
===
--- unittests/change-namespace/ChangeNamespaceTests.cpp
+++ unittests/change-namespace/ChangeNamespaceTests.cpp
@@ -242,7 +242,7 @@
  "} // namespace na\n"
  "namespace x {\n"
  "namespace y {\n"
- "class X { ::na::A a; z::Z zz; T t; };\n"
+ "class X { na::A a; z::Z zz; T t; };\n"
  "} // namespace y\n"
  "} // namespace x\n";
   EXPECT_EQ(format(Expected), runChangeNamespaceOnCode(Code));
@@ -296,8 +296,8 @@
  "namespace y {\n"
  "class C_X {\n"
  "public:\n"
- "  ::na::C_A a;\n"
- "  ::na::nc::C_C c;\n"
+ "  na::C_A a;\n"
+ "  na::nc::C_C c;\n"
  "};\n"
  "class C_Y {\n"
  "  C_X x;\n"
@@ -339,9 +339,9 @@
  "namespace x {\n"
  "namespace y {\n"
  "void f() {\n"
- "  ::na::B<::na::A> b;\n"
- "  ::na::B<::na::nc::C> b_c;\n"
- "  ::na::Two<::na::A, ::na::nc::C> two;\n"
+ "  na::B b;\n"
+ "  na::B b_c;\n"
+ "  na::Two two;\n"
  "}\n"
  "} // namespace y\n"
  "} // namespace x\n";
@@ -368,7 +368,7 @@
  "namespace y {\n"
  "\n"
  "class A {\n"
- "  ::na::nb::FWD *fwd;\n"
+ "  na::nb::FWD *fwd;\n"
  "};\n"
  "} // namespace y\n"
  "} // namespace x\n";
@@ -397,7 +397,7 @@
  "namespace y {\n"
  "\n"
  "class A {\n"
- "  ::na::nb::FWD *fwd;\n"
+ "  na::nb::FWD *fwd;\n"
  "};\n"
  "\n"
  "} // namespace y\n"
@@ -426,7 +426,7 @@
  "namespace y {\n"
  "\n"
  "class A {\n"
- "  ::na::nb::FWD *fwd;\n"
+ "  na::nb::FWD *fwd;\n"
  "};\n"
  "template class TEMP {};\n"
  "} // namespace y\n"
@@ -481,8 +481,8 @@
  "namespace x {\n"
  "namespace y {\n"
  "void fwd();\n"
- "void f(::na::C_A ca, ::na::nc::C_C cc) {\n"
- "  ::na::C_A ca_1 = ca;\n"
+ "void f(na::C_A ca, na::nc::C_C cc) {\n"
+ "  na::C_A ca_1 = ca;\n"
  "}\n"
  "} // namespace y\n"
  "} // namespace x\n";
@@ -521,9 +521,9 @@
  "namespace x {\n"
  "namespace y {\n"
  "using ::na::nc::SAME;\n"
- "using YO = ::na::nd::SAME;\n"
- "typedef ::na::nd::SAME IDENTICAL;\n"
- "void f(::na::nd::SAME Same) {}\n"
+ "using YO = na::nd::SAME;\n"
+ "typedef na::nd::SAME IDENTICAL;\n"
+ "void f(na::nd::SAME Same) {}\n"
  "} // namespace y\n"
  "} // namespace x\n";
   EXPECT_EQ(format(Expected), runChangeNamespaceOnCode(Code));
@@ -549,9 +549,9 @@
  "} // namespace na\n"
  "namespace x {\n"
  "namespace y {\n"
- "class D : public ::na::Base {\n"
+ "class D : public na::Base {\n"
  "public:\n"
- "  using AA = ::na::A; using B = ::na::Base;\n"
+ "  using AA = na::A; using B = na::Base;\n"
  "  using Base::m; using Base::Base;\n"
  "};"
  "} // namespace y\n"
@@ -596,11 +596,11 @@
   "namespace x {\n"
   "namespace y {\n"
   "class C_X {\n"
-  "  ::na::C_A na;\n"
-  "  ::na::C_A::Nested nested;\n"
+  "  na:

[clang-tools-extra] r298363 - [change-namespace] avoid adding leading '::' when possible.

2017-03-21 Thread Eric Liu via cfe-commits
Author: ioeric
Date: Tue Mar 21 07:41:59 2017
New Revision: 298363

URL: http://llvm.org/viewvc/llvm-project?rev=298363&view=rev
Log:
[change-namespace] avoid adding leading '::' when possible.

Summary:
When changing namespaces, the tool adds leading "::" to references that need to
be fully-qualified, which would affect readability.

We avoid adding "::" when the symbol name does not conflict with the new
namespace name. For example, a symbol name "na::nb::X" conflicts with "ns::na"
since it would be resolved to "ns::na::nb::X" in the new namespace.

Reviewers: hokein

Reviewed By: hokein

Subscribers: cfe-commits

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

Modified:
clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp
clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp

Modified: clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp?rev=298363&r1=298362&r2=298363&view=diff
==
--- clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp (original)
+++ clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp Tue Mar 21 
07:41:59 2017
@@ -28,6 +28,14 @@ joinNamespaces(const llvm::SmallVectorIm
   return Result;
 }
 
+// Given "a::b::c", returns {"a", "b", "c"}.
+llvm::SmallVector splitSymbolName(llvm::StringRef Name) {
+  llvm::SmallVector Splitted;
+  Name.split(Splitted, "::", /*MaxSplit=*/-1,
+ /*KeepEmpty=*/false);
+  return Splitted;
+}
+
 SourceLocation startLocationForType(TypeLoc TLoc) {
   // For elaborated types (e.g. `struct a::A`) we want the portion after the
   // `struct` but including the namespace qualifier, `a::`.
@@ -68,9 +76,7 @@ const NamespaceDecl *getOuterNamespace(c
 return nullptr;
   const auto *CurrentContext = llvm::cast(InnerNs);
   const auto *CurrentNs = InnerNs;
-  llvm::SmallVector PartialNsNameSplitted;
-  PartialNsName.split(PartialNsNameSplitted, "::", /*MaxSplit=*/-1,
-  /*KeepEmpty=*/false);
+  auto PartialNsNameSplitted = splitSymbolName(PartialNsName);
   while (!PartialNsNameSplitted.empty()) {
 // Get the inner-most namespace in CurrentContext.
 while (CurrentContext && !llvm::isa(CurrentContext))
@@ -208,12 +214,8 @@ std::string getShortestQualifiedNameInNa
   if (DeclName.find(':') == llvm::StringRef::npos)
 return DeclName;
 
-  llvm::SmallVector NsNameSplitted;
-  NsName.split(NsNameSplitted, "::", /*MaxSplit=*/-1,
-   /*KeepEmpty=*/false);
-  llvm::SmallVector DeclNsSplitted;
-  DeclName.split(DeclNsSplitted, "::", /*MaxSplit=*/-1,
-   /*KeepEmpty=*/false);
+  auto NsNameSplitted = splitSymbolName(NsName);
+  auto DeclNsSplitted = splitSymbolName(DeclName);
   llvm::StringRef UnqualifiedDeclName = DeclNsSplitted.pop_back_val();
   // If the Decl is in global namespace, there is no need to shorten it.
   if (DeclNsSplitted.empty())
@@ -249,9 +251,7 @@ std::string getShortestQualifiedNameInNa
 std::string wrapCodeInNamespace(StringRef NestedNs, std::string Code) {
   if (Code.back() != '\n')
 Code += "\n";
-  llvm::SmallVector NsSplitted;
-  NestedNs.split(NsSplitted, "::", /*MaxSplit=*/-1,
- /*KeepEmpty=*/false);
+  auto NsSplitted = splitSymbolName(NestedNs);
   while (!NsSplitted.empty()) {
 // FIXME: consider code style for comments.
 Code = ("namespace " + NsSplitted.back() + " {\n" + Code +
@@ -282,6 +282,28 @@ bool isDeclVisibleAtLocation(const Sourc
   isNestedDeclContext(DeclCtx, D->getDeclContext()));
 }
 
+// Given a qualified symbol name, returns true if the symbol will be
+// incorrectly qualified without leading "::".
+bool conflictInNamespace(llvm::StringRef QualifiedSymbol,
+ llvm::StringRef Namespace) {
+  auto SymbolSplitted = splitSymbolName(QualifiedSymbol.trim(":"));
+  assert(!SymbolSplitted.empty());
+  SymbolSplitted.pop_back();  // We are only interested in namespaces.
+
+  if (SymbolSplitted.size() > 1 && !Namespace.empty()) {
+auto NsSplitted = splitSymbolName(Namespace.trim(":"));
+assert(!NsSplitted.empty());
+// We do not check the outermost namespace since it would not be a conflict
+// if it equals to the symbol's outermost namespace and the symbol name
+// would have been shortened.
+for (auto I = NsSplitted.begin() + 1, E = NsSplitted.end(); I != E; ++I) {
+  if (*I == SymbolSplitted.front())
+return true;
+}
+  }
+  return false;
+}
+
 AST_MATCHER(EnumDecl, isScoped) {
 return Node.isScoped();
 }
@@ -306,10 +328,8 @@ ChangeNamespaceTool::ChangeNamespaceTool
   OldNamespace(OldNs.ltrim(':')), NewNamespace(NewNs.ltrim(':')),
   FilePattern(FilePattern), FilePatternRE(FilePattern) {
   FileToReplacements->clear();
-  llvm::SmallVector OldNsSplitted;
-  llvm::SmallVector NewNsSplitted;
-  llvm::StringRef(OldNa

[PATCH] D30493: [change-namespace] avoid adding leading '::' when possible.

2017-03-21 Thread Eric Liu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL298363: [change-namespace] avoid adding leading '::' when 
possible. (authored by ioeric).

Changed prior to commit:
  https://reviews.llvm.org/D30493?vs=92475&id=92476#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D30493

Files:
  clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp
  clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp

Index: clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp
===
--- clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp
+++ clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp
@@ -28,6 +28,14 @@
   return Result;
 }
 
+// Given "a::b::c", returns {"a", "b", "c"}.
+llvm::SmallVector splitSymbolName(llvm::StringRef Name) {
+  llvm::SmallVector Splitted;
+  Name.split(Splitted, "::", /*MaxSplit=*/-1,
+ /*KeepEmpty=*/false);
+  return Splitted;
+}
+
 SourceLocation startLocationForType(TypeLoc TLoc) {
   // For elaborated types (e.g. `struct a::A`) we want the portion after the
   // `struct` but including the namespace qualifier, `a::`.
@@ -68,9 +76,7 @@
 return nullptr;
   const auto *CurrentContext = llvm::cast(InnerNs);
   const auto *CurrentNs = InnerNs;
-  llvm::SmallVector PartialNsNameSplitted;
-  PartialNsName.split(PartialNsNameSplitted, "::", /*MaxSplit=*/-1,
-  /*KeepEmpty=*/false);
+  auto PartialNsNameSplitted = splitSymbolName(PartialNsName);
   while (!PartialNsNameSplitted.empty()) {
 // Get the inner-most namespace in CurrentContext.
 while (CurrentContext && !llvm::isa(CurrentContext))
@@ -208,12 +214,8 @@
   if (DeclName.find(':') == llvm::StringRef::npos)
 return DeclName;
 
-  llvm::SmallVector NsNameSplitted;
-  NsName.split(NsNameSplitted, "::", /*MaxSplit=*/-1,
-   /*KeepEmpty=*/false);
-  llvm::SmallVector DeclNsSplitted;
-  DeclName.split(DeclNsSplitted, "::", /*MaxSplit=*/-1,
-   /*KeepEmpty=*/false);
+  auto NsNameSplitted = splitSymbolName(NsName);
+  auto DeclNsSplitted = splitSymbolName(DeclName);
   llvm::StringRef UnqualifiedDeclName = DeclNsSplitted.pop_back_val();
   // If the Decl is in global namespace, there is no need to shorten it.
   if (DeclNsSplitted.empty())
@@ -249,9 +251,7 @@
 std::string wrapCodeInNamespace(StringRef NestedNs, std::string Code) {
   if (Code.back() != '\n')
 Code += "\n";
-  llvm::SmallVector NsSplitted;
-  NestedNs.split(NsSplitted, "::", /*MaxSplit=*/-1,
- /*KeepEmpty=*/false);
+  auto NsSplitted = splitSymbolName(NestedNs);
   while (!NsSplitted.empty()) {
 // FIXME: consider code style for comments.
 Code = ("namespace " + NsSplitted.back() + " {\n" + Code +
@@ -282,6 +282,28 @@
   isNestedDeclContext(DeclCtx, D->getDeclContext()));
 }
 
+// Given a qualified symbol name, returns true if the symbol will be
+// incorrectly qualified without leading "::".
+bool conflictInNamespace(llvm::StringRef QualifiedSymbol,
+ llvm::StringRef Namespace) {
+  auto SymbolSplitted = splitSymbolName(QualifiedSymbol.trim(":"));
+  assert(!SymbolSplitted.empty());
+  SymbolSplitted.pop_back();  // We are only interested in namespaces.
+
+  if (SymbolSplitted.size() > 1 && !Namespace.empty()) {
+auto NsSplitted = splitSymbolName(Namespace.trim(":"));
+assert(!NsSplitted.empty());
+// We do not check the outermost namespace since it would not be a conflict
+// if it equals to the symbol's outermost namespace and the symbol name
+// would have been shortened.
+for (auto I = NsSplitted.begin() + 1, E = NsSplitted.end(); I != E; ++I) {
+  if (*I == SymbolSplitted.front())
+return true;
+}
+  }
+  return false;
+}
+
 AST_MATCHER(EnumDecl, isScoped) {
 return Node.isScoped();
 }
@@ -306,10 +328,8 @@
   OldNamespace(OldNs.ltrim(':')), NewNamespace(NewNs.ltrim(':')),
   FilePattern(FilePattern), FilePatternRE(FilePattern) {
   FileToReplacements->clear();
-  llvm::SmallVector OldNsSplitted;
-  llvm::SmallVector NewNsSplitted;
-  llvm::StringRef(OldNamespace).split(OldNsSplitted, "::");
-  llvm::StringRef(NewNamespace).split(NewNsSplitted, "::");
+  auto OldNsSplitted = splitSymbolName(OldNamespace);
+  auto NewNsSplitted = splitSymbolName(NewNamespace);
   // Calculates `DiffOldNamespace` and `DiffNewNamespace`.
   while (!OldNsSplitted.empty() && !NewNsSplitted.empty() &&
  OldNsSplitted.front() == NewNsSplitted.front()) {
@@ -825,7 +845,8 @@
 return;
   // If the reference need to be fully-qualified, add a leading "::" unless
   // NewNamespace is the global namespace.
-  if (ReplaceName == FromDeclName && !NewNamespace.empty())
+  if (ReplaceName == FromDeclName && !NewNamespace.empty() &&
+  conflictInNamespace(ReplaceName, NewNamespace))
 ReplaceName = "::" + ReplaceName;
   addReplacementOrDie(Start, End, ReplaceN

r298364 - [X86][AVX512] Add _mm512_cvtsd_f64 and _mm512_cvtss_f32 intrinsics (PR32305)

2017-03-21 Thread Simon Pilgrim via cfe-commits
Author: rksimon
Date: Tue Mar 21 07:46:13 2017
New Revision: 298364

URL: http://llvm.org/viewvc/llvm-project?rev=298364&view=rev
Log:
[X86][AVX512] Add _mm512_cvtsd_f64 and _mm512_cvtss_f32 intrinsics (PR32305)

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

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=298364&r1=298363&r2=298364&view=diff
==
--- cfe/trunk/lib/Headers/avx512fintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512fintrin.h Tue Mar 21 07:46:13 2017
@@ -4229,6 +4229,18 @@ _mm512_maskz_cvtpd_epu32 (__mmask8 __U,
   _MM_FROUND_CUR_DIRECTION);
 }
 
+static __inline__ double __DEFAULT_FN_ATTRS
+_mm512_cvtsd_f64(__m512d __a)
+{
+  return __a[0];
+}
+
+static __inline__ float __DEFAULT_FN_ATTRS
+_mm512_cvtss_f32(__m512 __a)
+{
+  return __a[0];
+}
+
 /* Unpack and Interleave */
 
 static __inline __m512d __DEFAULT_FN_ATTRS

Modified: cfe/trunk/test/CodeGen/avx512f-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512f-builtins.c?rev=298364&r1=298363&r2=298364&view=diff
==
--- cfe/trunk/test/CodeGen/avx512f-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx512f-builtins.c Tue Mar 21 07:46:13 2017
@@ -7259,6 +7259,18 @@ __m512i test_mm512_maskz_cvtps_epu32 (__
   return _mm512_maskz_cvtps_epu32( __U, __A);
 }
 
+double test_mm512_cvtsd_f64(__m512d A) {
+  // CHECK-LABEL: test_mm512_cvtsd_f64
+  // CHECK: extractelement <8 x double> %{{.*}}, i32 0
+  return _mm512_cvtsd_f64(A);
+}
+
+float test_mm512_cvtss_f32(__m512 A) {
+  // CHECK-LABEL: test_mm512_cvtss_f32
+  // CHECK: extractelement <16 x float> %{{.*}}, i32 0
+  return _mm512_cvtss_f32(A);
+}
+
 __m512d test_mm512_mask_max_pd (__m512d __W, __mmask8 __U, __m512d __A, 
__m512d __B)
 {
   // CHECK-LABEL: @test_mm512_mask_max_pd 


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


[PATCH] D31155: [X86][AVX512] Add _mm512_cvtsd_f64 and _mm512_cvtss_f32 intrinsics (PR32305)

2017-03-21 Thread Simon Pilgrim via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL298364: [X86][AVX512] Add _mm512_cvtsd_f64 and 
_mm512_cvtss_f32 intrinsics (PR32305) (authored by RKSimon).

Changed prior to commit:
  https://reviews.llvm.org/D31155?vs=92390&id=92477#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D31155

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
@@ -7259,6 +7259,18 @@
   return _mm512_maskz_cvtps_epu32( __U, __A);
 }
 
+double test_mm512_cvtsd_f64(__m512d A) {
+  // CHECK-LABEL: test_mm512_cvtsd_f64
+  // CHECK: extractelement <8 x double> %{{.*}}, i32 0
+  return _mm512_cvtsd_f64(A);
+}
+
+float test_mm512_cvtss_f32(__m512 A) {
+  // CHECK-LABEL: test_mm512_cvtss_f32
+  // CHECK: extractelement <16 x float> %{{.*}}, i32 0
+  return _mm512_cvtss_f32(A);
+}
+
 __m512d test_mm512_mask_max_pd (__m512d __W, __mmask8 __U, __m512d __A, 
__m512d __B)
 {
   // CHECK-LABEL: @test_mm512_mask_max_pd 
Index: cfe/trunk/lib/Headers/avx512fintrin.h
===
--- cfe/trunk/lib/Headers/avx512fintrin.h
+++ cfe/trunk/lib/Headers/avx512fintrin.h
@@ -4229,6 +4229,18 @@
   _MM_FROUND_CUR_DIRECTION);
 }
 
+static __inline__ double __DEFAULT_FN_ATTRS
+_mm512_cvtsd_f64(__m512d __a)
+{
+  return __a[0];
+}
+
+static __inline__ float __DEFAULT_FN_ATTRS
+_mm512_cvtss_f32(__m512 __a)
+{
+  return __a[0];
+}
+
 /* Unpack and Interleave */
 
 static __inline __m512d __DEFAULT_FN_ATTRS


Index: cfe/trunk/test/CodeGen/avx512f-builtins.c
===
--- cfe/trunk/test/CodeGen/avx512f-builtins.c
+++ cfe/trunk/test/CodeGen/avx512f-builtins.c
@@ -7259,6 +7259,18 @@
   return _mm512_maskz_cvtps_epu32( __U, __A);
 }
 
+double test_mm512_cvtsd_f64(__m512d A) {
+  // CHECK-LABEL: test_mm512_cvtsd_f64
+  // CHECK: extractelement <8 x double> %{{.*}}, i32 0
+  return _mm512_cvtsd_f64(A);
+}
+
+float test_mm512_cvtss_f32(__m512 A) {
+  // CHECK-LABEL: test_mm512_cvtss_f32
+  // CHECK: extractelement <16 x float> %{{.*}}, i32 0
+  return _mm512_cvtss_f32(A);
+}
+
 __m512d test_mm512_mask_max_pd (__m512d __W, __mmask8 __U, __m512d __A, __m512d __B)
 {
   // CHECK-LABEL: @test_mm512_mask_max_pd 
Index: cfe/trunk/lib/Headers/avx512fintrin.h
===
--- cfe/trunk/lib/Headers/avx512fintrin.h
+++ cfe/trunk/lib/Headers/avx512fintrin.h
@@ -4229,6 +4229,18 @@
   _MM_FROUND_CUR_DIRECTION);
 }
 
+static __inline__ double __DEFAULT_FN_ATTRS
+_mm512_cvtsd_f64(__m512d __a)
+{
+  return __a[0];
+}
+
+static __inline__ float __DEFAULT_FN_ATTRS
+_mm512_cvtss_f32(__m512 __a)
+{
+  return __a[0];
+}
+
 /* Unpack and Interleave */
 
 static __inline __m512d __DEFAULT_FN_ATTRS
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D28952: [analyzer] Add new Z3 constraint manager backend

2017-03-21 Thread GĂ¡bor HorvĂ¡th via Phabricator via cfe-commits
xazax.hun added inline comments.



Comment at: lib/StaticAnalyzer/Core/Z3ConstraintManager.cpp:60
+// Set timeout to 15000ms = 15s
+Z3_set_param_value(Config, "timeout", "15000");
+  }

Sorry for being a bit late in the party, I was wondering whether this timeout 
can be a source of non-determinism. The constraint solver might get lucky or 
unlucky based on the load or the underlying hardware to solve some of the 
constraints. We might end up with different results over different runs which 
can be confusing for the users. Is there any other way, to set something like a 
timeout, like limiting the number of steps inside the solver?


https://reviews.llvm.org/D28952



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


r298366 - [OpenCL] Added implicit conversion rank for overloading functions with vector data type in OpenCL

2017-03-21 Thread Egor Churaev via cfe-commits
Author: echuraev
Date: Tue Mar 21 07:55:55 2017
New Revision: 298366

URL: http://llvm.org/viewvc/llvm-project?rev=298366&view=rev
Log:
[OpenCL] Added implicit conversion rank for overloading functions with vector 
data type in OpenCL

Summary: I added a new rank to ImplicitConversionRank enum to resolve the 
function overload ambiguity with vector types. Rank of scalar types conversion 
is lower than vector splat. So, we can choose which function should we call. 
See test for more details.

Reviewers: Anastasia, cfe-commits

Reviewed By: Anastasia

Subscribers: bader, yaxunl

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

Added:
cfe/trunk/test/CodeGenOpenCL/overload.cl
Removed:
cfe/trunk/test/SemaOpenCL/overload_addrspace_resolution.cl
Modified:
cfe/trunk/include/clang/Sema/Overload.h
cfe/trunk/lib/Sema/SemaOverload.cpp

Modified: cfe/trunk/include/clang/Sema/Overload.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Overload.h?rev=298366&r1=298365&r2=298366&view=diff
==
--- cfe/trunk/include/clang/Sema/Overload.h (original)
+++ cfe/trunk/include/clang/Sema/Overload.h Tue Mar 21 07:55:55 2017
@@ -98,6 +98,7 @@ namespace clang {
 ICR_Exact_Match = 0, ///< Exact Match
 ICR_Promotion,   ///< Promotion
 ICR_Conversion,  ///< Conversion
+ICR_OCL_Scalar_Widening, ///< OpenCL Scalar Widening
 ICR_Complex_Real_Conversion, ///< Complex <-> Real conversion
 ICR_Writeback_Conversion,///< ObjC ARC writeback conversion
 ICR_C_Conversion,///< Conversion only allowed in the C 
standard.

Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=298366&r1=298365&r2=298366&view=diff
==
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Tue Mar 21 07:55:55 2017
@@ -131,7 +131,7 @@ ImplicitConversionRank clang::GetConvers
 ICR_Conversion,
 ICR_Conversion,
 ICR_Conversion,
-ICR_Conversion,
+ICR_OCL_Scalar_Widening,
 ICR_Complex_Real_Conversion,
 ICR_Conversion,
 ICR_Conversion,

Added: cfe/trunk/test/CodeGenOpenCL/overload.cl
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenOpenCL/overload.cl?rev=298366&view=auto
==
--- cfe/trunk/test/CodeGenOpenCL/overload.cl (added)
+++ cfe/trunk/test/CodeGenOpenCL/overload.cl Tue Mar 21 07:55:55 2017
@@ -0,0 +1,46 @@
+// RUN: %clang_cc1 -cl-std=CL2.0 -emit-llvm -o - -triple spir-unknown-unknown 
%s | FileCheck %s
+
+typedef short short4 __attribute__((ext_vector_type(4)));
+
+// CHECK-DAG: declare spir_func <4 x i16> @_Z5clampDv4_sS_S_(<4 x i16>, <4 x 
i16>, <4 x i16>)
+short4 __attribute__ ((overloadable)) clamp(short4 x, short4 minval, short4 
maxval);
+// CHECK-DAG: declare spir_func <4 x i16> @_Z5clampDv4_sss(<4 x i16>, i16 
signext, i16 signext)
+short4 __attribute__ ((overloadable)) clamp(short4 x, short minval, short 
maxval);
+void __attribute__((overloadable)) foo(global int *a, global int *b);
+void __attribute__((overloadable)) foo(generic int *a, generic int *b);
+void __attribute__((overloadable)) bar(generic int *global *a, generic int 
*global *b);
+void __attribute__((overloadable)) bar(generic int *generic *a, generic int 
*generic *b);
+
+// Checking address space resolution
+void kernel test1() {
+  global int *a;
+  global int *b;
+  generic int *c;
+  local int *d;
+  generic int *generic *gengen;
+  generic int *local *genloc;
+  generic int *global *genglob;
+  // CHECK-DAG: call spir_func void @_Z3fooPU3AS1iS0_(i32 addrspace(1)* undef, 
i32 addrspace(1)* undef)
+  foo(a, b);
+  // CHECK-DAG: call spir_func void @_Z3fooPU3AS4iS0_(i32 addrspace(4)* undef, 
i32 addrspace(4)* undef)
+  foo(b, c);
+  // CHECK-DAG: call spir_func void @_Z3fooPU3AS4iS0_(i32 addrspace(4)* undef, 
i32 addrspace(4)* undef)
+  foo(a, d);
+
+  // CHECK-DAG: call spir_func void @_Z3barPU3AS4PU3AS4iS2_(i32 addrspace(4)* 
addrspace(4)* undef, i32 addrspace(4)* addrspace(4)* undef)
+  bar(gengen, genloc);
+  // CHECK-DAG: call spir_func void @_Z3barPU3AS4PU3AS4iS2_(i32 addrspace(4)* 
addrspace(4)* undef, i32 addrspace(4)* addrspace(4)* undef)
+  bar(gengen, genglob);
+  // CHECK-DAG: call spir_func void @_Z3barPU3AS1PU3AS4iS2_(i32 addrspace(4)* 
addrspace(1)* undef, i32 addrspace(4)* addrspace(1)* undef)
+  bar(genglob, genglob);
+}
+
+// Checking vector vs scalar resolution
+void kernel test2() {
+  short4 e0=0;
+
+  // CHECK-DAG: call spir_func <4 x i16> @_Z5clampDv4_sss(<4 x i16> 
zeroinitializer, i16 signext 0, i16 signext 255)
+  clamp(e0, 0, 255);
+  // CHECK-DAG: call spir_func <4 x i16> @_Z5clampDv4_sS_S_(<4 x i16> 
zeroinitializer, <4 x i16> zeroinitializer, <4 x i16> zeroinitializer)

[PATCH] D30739: [OpenMP] "declare simd" for AArch64 Advanced SIMD.

2017-03-21 Thread Francesco Petrogalli via Phabricator via cfe-commits
fpetrogalli added a comment.

In https://reviews.llvm.org/D30739#706292, @Hahnfeld wrote:

> In principal looks good to me although I'm not really familiar with this 
> part. Does that work for you if you have the `declare simd` in a header file 
> and the implementation in another file? On x86_64 I currently get:


The current infrastructure for vector names generation works only for function 
definition. Ideally we should implement it also for function definition 
provided by external libraries.

>   remark: loop not vectorized: call instruction cannot be vectorized
> 
> 
> But that seems to be a general problem inside LLVM's LoopVectorize pass...

AFAIK, none of the machinery required in LLVM to expose the mangled names in 
the vectorizer is present in trunk. There is a patch for x86 under review that 
does that: https://reviews.llvm.org/D22792


https://reviews.llvm.org/D30739



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


[PATCH] D30739: [OpenMP] "declare simd" for AArch64 Advanced SIMD.

2017-03-21 Thread Jonas Hahnfeld via Phabricator via cfe-commits
Hahnfeld accepted this revision.
Hahnfeld added a comment.
This revision is now accepted and ready to land.

In https://reviews.llvm.org/D30739#706304, @fpetrogalli wrote:

> AFAIK, none of the machinery required in LLVM to expose the mangled names in 
> the vectorizer is present in trunk. There is a patch for x86 under review 
> that does that: https://reviews.llvm.org/D22792


Thanks for the link. I think this patch is fine in that case.


https://reviews.llvm.org/D30739



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


[PATCH] D30739: [OpenMP] "declare simd" for AArch64 Advanced SIMD.

2017-03-21 Thread Francesco Petrogalli via Phabricator via cfe-commits
fpetrogalli added a comment.

Thanks, I do not have commit rights, can anyone commit this?


https://reviews.llvm.org/D30739



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


r298369 - [OpenCL] Added diagnostic for checking length of vector

2017-03-21 Thread Egor Churaev via cfe-commits
Author: echuraev
Date: Tue Mar 21 08:20:57 2017
New Revision: 298369

URL: http://llvm.org/viewvc/llvm-project?rev=298369&view=rev
Log:
[OpenCL] Added diagnostic for checking length of vector

Reviewers: Anastasia, cfe-commits

Reviewed By: Anastasia

Subscribers: bader, yaxunl

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

Added:
cfe/trunk/test/SemaOpenCL/vector_swizzle_length.cl
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaExprMember.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=298369&r1=298368&r2=298369&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue Mar 21 08:20:57 
2017
@@ -8236,6 +8236,8 @@ def err_opencl_ptrptr_kernel_param : Err
 def err_kernel_arg_address_space : Error<
   "pointer arguments to kernel functions must reside in '__global', "
   "'__constant' or '__local' address space">;
+def err_opencl_ext_vector_component_invalid_length : Error<
+  "vector component access has invalid length %0.  Supported: 1,2,3,4,8,16.">;
 def err_opencl_function_variable : Error<
   "%select{non-kernel function|function scope}0 variable cannot be declared in 
%1 address space">;
 def err_static_function_scope : Error<

Modified: cfe/trunk/lib/Sema/SemaExprMember.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprMember.cpp?rev=298369&r1=298368&r2=298369&view=diff
==
--- cfe/trunk/lib/Sema/SemaExprMember.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprMember.cpp Tue Mar 21 08:20:57 2017
@@ -284,6 +284,14 @@ IsRGBA(char c) {
   }
 }
 
+// OpenCL v1.1, s6.1.7
+// The component swizzle length must be in accordance with the acceptable
+// vector sizes.
+static bool IsValidOpenCLComponentSwizzleLength(unsigned len)
+{
+  return (len >= 1 && len <= 4) || len == 8 || len == 16;
+}
+
 /// Check an ext-vector component access expression.
 ///
 /// VK should be set in advance to the value kind of the base
@@ -376,6 +384,19 @@ CheckExtVectorComponent(Sema &S, QualTyp
 }
   }
 
+  if (!HalvingSwizzle) {
+unsigned SwizzleLength = CompName->getLength();
+
+if (HexSwizzle)
+  SwizzleLength--;
+
+if (IsValidOpenCLComponentSwizzleLength(SwizzleLength) == false) {
+  S.Diag(OpLoc, diag::err_opencl_ext_vector_component_invalid_length)
+<< SwizzleLength << SourceRange(CompLoc);
+  return QualType();
+}
+  }
+
   // The component accessor looks fine - now we need to compute the actual 
type.
   // The vector type is implied by the component accessor. For example,
   // vec4.b is a float, vec4.xy is a vec2, vec4.rgb is a vec3, etc.

Added: cfe/trunk/test/SemaOpenCL/vector_swizzle_length.cl
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaOpenCL/vector_swizzle_length.cl?rev=298369&view=auto
==
--- cfe/trunk/test/SemaOpenCL/vector_swizzle_length.cl (added)
+++ cfe/trunk/test/SemaOpenCL/vector_swizzle_length.cl Tue Mar 21 08:20:57 2017
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
+
+typedef float float8 __attribute__((ext_vector_type(8)));
+
+void foo() {
+float8 f2 = (float8)(0, 0, 0, 0, 0, 0, 0, 0);
+
+f2.s01234; // expected-error {{vector component access has invalid length 
5.  Supported: 1,2,3,4,8,16}}
+f2.xyzxy; // expected-error {{vector component access has invalid length 
5.  Supported: 1,2,3,4,8,16}}
+}


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


[PATCH] D31187: Fix removal of out-of-line definitions.

2017-03-21 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev created this revision.

Consider:

`
struct MyClass {

  void f() {}

}
MyClass::f(){} // expected error redefinition of f.
`

The routine fails to remove the lookup entry is registered in the semantic decl 
context and not in the primary decl context of the lexical decl context where 
we currently are trying to remove it from.


Repository:
  rL LLVM

https://reviews.llvm.org/D31187

Files:
  lib/AST/DeclBase.cpp


Index: lib/AST/DeclBase.cpp
===
--- lib/AST/DeclBase.cpp
+++ lib/AST/DeclBase.cpp
@@ -1254,7 +1254,7 @@
 // Remove only decls that have a name
 if (!ND->getDeclName()) return;
 
-auto *DC = this;
+auto *DC = D->getDeclContext();
 do {
   StoredDeclsMap *Map = DC->getPrimaryContext()->LookupPtr;
   if (Map) {


Index: lib/AST/DeclBase.cpp
===
--- lib/AST/DeclBase.cpp
+++ lib/AST/DeclBase.cpp
@@ -1254,7 +1254,7 @@
 // Remove only decls that have a name
 if (!ND->getDeclName()) return;
 
-auto *DC = this;
+auto *DC = D->getDeclContext();
 do {
   StoredDeclsMap *Map = DC->getPrimaryContext()->LookupPtr;
   if (Map) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D31187: Fix removal of out-of-line definitions.

2017-03-21 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev updated this revision to Diff 92481.
v.g.vassilev edited the summary of this revision.
v.g.vassilev added a comment.

U


https://reviews.llvm.org/D31187

Files:
  lib/AST/DeclBase.cpp


Index: lib/AST/DeclBase.cpp
===
--- lib/AST/DeclBase.cpp
+++ lib/AST/DeclBase.cpp
@@ -1301,7 +1301,7 @@
 // Remove only decls that have a name
 if (!ND->getDeclName()) return;
 
-auto *DC = this;
+auto *DC = D->getDeclContext();
 do {
   StoredDeclsMap *Map = DC->getPrimaryContext()->LookupPtr;
   if (Map) {


Index: lib/AST/DeclBase.cpp
===
--- lib/AST/DeclBase.cpp
+++ lib/AST/DeclBase.cpp
@@ -1301,7 +1301,7 @@
 // Remove only decls that have a name
 if (!ND->getDeclName()) return;
 
-auto *DC = this;
+auto *DC = D->getDeclContext();
 do {
   StoredDeclsMap *Map = DC->getPrimaryContext()->LookupPtr;
   if (Map) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r298371 - [DOXYGEN] Improvements to smmintrin.h and emmintrin.h intrinsics.

2017-03-21 Thread Ekaterina Romanova via cfe-commits
Author: kromanova
Date: Tue Mar 21 08:34:06 2017
New Revision: 298371

URL: http://llvm.org/viewvc/llvm-project?rev=298371&view=rev
Log:
[DOXYGEN] Improvements to smmintrin.h and emmintrin.h intrinsics.

I made some small changes in smmintrin.h and emmintrin.h intrinsics.
 - changed some regular comments '//' into doxygen-style comments '///' where 
necessary
 - removed some trailing spaces in doxygen comments.

I got an OK from Eric Christopher to commit doxygen comments without prior code
review upstream.


Modified:
cfe/trunk/lib/Headers/emmintrin.h
cfe/trunk/lib/Headers/smmintrin.h

Modified: cfe/trunk/lib/Headers/emmintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/emmintrin.h?rev=298371&r1=298370&r2=298371&view=diff
==
--- cfe/trunk/lib/Headers/emmintrin.h (original)
+++ cfe/trunk/lib/Headers/emmintrin.h Tue Mar 21 08:34:06 2017
@@ -1809,7 +1809,7 @@ _mm_setzero_pd(void)
 /// \brief Constructs a 128-bit floating-point vector of [2 x double]. The 
lower
 ///64 bits are set to the lower 64 bits of the second parameter. The upper
 ///64 bits are set to the upper 64 bits of the first parameter.
-//
+///
 /// \headerfile 
 ///
 /// This intrinsic corresponds to the  VBLENDPD / BLENDPD  instruction.

Modified: cfe/trunk/lib/Headers/smmintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/smmintrin.h?rev=298371&r1=298370&r2=298371&view=diff
==
--- cfe/trunk/lib/Headers/smmintrin.h (original)
+++ cfe/trunk/lib/Headers/smmintrin.h Tue Mar 21 08:34:06 2017
@@ -174,7 +174,7 @@
 ///the corresponding three upper elements of the 128-bit result vector of
 ///[4 x float]. Rounds down the lowest element of the second 128-bit vector
 ///operand to an integer and copies it to the lowest element of the 128-bit
-///result vector of [4 x float]. 
+///result vector of [4 x float].
 ///
 /// \headerfile 
 ///
@@ -256,7 +256,7 @@
 #define _mm_round_ps(X, M) __extension__ ({ \
   (__m128)__builtin_ia32_roundps((__v4sf)(__m128)(X), (M)); })
 
-/// \brief Copies three upper elements of the first 128-bit vector operand to 
+/// \brief Copies three upper elements of the first 128-bit vector operand to
 ///the corresponding three upper elements of the 128-bit result vector of
 ///[4 x float]. Rounds the lowest element of the second 128-bit vector
 ///operand to an integer value according to the rounding control specified
@@ -265,7 +265,7 @@
 ///
 /// \headerfile 
 ///
-/// \code   
+/// \code
 /// __m128 _mm_round_ss(__m128 X, __m128 Y, const int M);
 /// \endcode
 ///
@@ -336,7 +336,7 @@
 
 /// \brief Copies the upper element of the first 128-bit vector operand to the
 ///corresponding upper element of the 128-bit result vector of [2 x 
double].
-///Rounds the lower element of the second 128-bit vector operand to an 
+///Rounds the lower element of the second 128-bit vector operand to an
 ///integer value according to the rounding control specified by the third
 ///argument and copies it to the lower element of the 128-bit result vector
 ///of [2 x double].
@@ -575,7 +575,7 @@ _mm_blendv_epi8 (__m128i __V1, __m128i _
 /// \param __V1
 ///A 128-bit integer vector.
 /// \param __V2
-///A 128-bit integer vector. 
+///A 128-bit integer vector.
 /// \returns A 128-bit integer vector containing the products of both operands.
 static __inline__  __m128i __DEFAULT_FN_ATTRS
 _mm_mullo_epi32 (__m128i __V1, __m128i __V2)
@@ -795,7 +795,7 @@ _mm_min_epi32 (__m128i __V1, __m128i __V
   return (__m128i) __builtin_ia32_pminsd128 ((__v4si) __V1, (__v4si) __V2);
 }
 
-/// \brief Compares the corresponding elements of two 128-bit vectors of 
+/// \brief Compares the corresponding elements of two 128-bit vectors of
 ///[4 x i32] and returns a 128-bit vector of [4 x i32] containing the
 ///greater value of the two.
 ///
@@ -914,7 +914,7 @@ _mm_max_epu32 (__m128i __V1, __m128i __V
 ///A 128-bit vector of [4 x float].
 /// \param N
 ///An immediate value. Bits [1:0] determines which bits from the argument
-///\a X are extracted and returned: \n 
+///\a X are extracted and returned: \n
 ///00: Bits [31:0] of parameter \a X are returned. \n
 ///01: Bits [63:32] of parameter \a X are returned. \n
 ///10: Bits [95:64] of parameter \a X are returned. \n
@@ -1023,7 +1023,7 @@ _mm_max_epu32 (__m128i __V1, __m128i __V
 /// \brief Constructs a 128-bit vector of [2 x i64] by first making a copy of
 ///the 128-bit integer vector parameter, and then inserting the 64-bit
 ///integer parameter \a I, using the immediate value parameter \a N as an
-///insertion location selector. 
+///insertion location selector.
 ///
 /// \headerfile 
 ///
@@ -1033,7 +1033,7 @@ _mm_max_epu32 (__m128i __V1, __m128i __V
 ///
 /// This intrin

FW: SemaAccess bug (protected members of derived)

2017-03-21 Thread Dixon Ryan (ETAS/ERS-PD2) via cfe-commits
Sending to mailing list.

From: Dixon Ryan (ETAS/ERS-PD2)
Sent: 21 March 2017 14:18
To: 'Alex L' 
Subject: RE: SemaAccess bug (protected members of derived)

Hello, sorry this is the first time I have done this.

The test case is attached. It should fail without the patch and then should 
pass with the patch.


class cl
{
public:
   void myPublic(int x){ }
protected:
   void myProtected(int y){ }
};

class clChild : public cl
{
   void myPrivate(int z)
   {
  this->
 // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:13:13 %s -o - 
| FileCheck -check-prefix=CHECK-CC1 %s
 // CHECK: COMPLETION: myProtected : [#void#][#cl::#]myProtected(<#int 
y#>)
   }
};


From: Alex L [mailto:arpha...@gmail.com]
Sent: 21 March 2017 12:17
To: Dixon Ryan (ETAS/ERS-PD2) mailto:ryan.di...@etas.com>>
Cc: cfe-commits@lists.llvm.org
Subject: Re: SemaAccess bug (protected members of derived)

Hi,

Can you please add a suitable test-case? Clang's code-completion tests are 
normally in test/CodeCompletion or test/Index.

Cheers,
Alex

On 21 March 2017 at 12:05, Dixon Ryan (ETAS/ERS-PD2) via cfe-commits 
mailto:cfe-commits@lists.llvm.org>> wrote:
There are a number of users of the clang static analyser back-end for 
intelligent code completion. Irony-Mode for emacs, for example. For a while 
people have been reporting an issue with not getting completions for protected 
members of parent classes and I believe this patch solves the bug: simply that 
the arguments to IsDerivedFromInclusive were the wrong way around.

URL: http://llvm.org/svn/llvm-project/cfe/trunk/lib/Sema
Relative URL: ^/cfe/trunk/lib/Sema

Index: SemaAccess.cpp
===
--- SemaAccess.cpp  (revision 297956)
+++ SemaAccess.cpp   (working copy)
@@ -823,7 +823,7 @@
 continue;
   }
-  switch (IsDerivedFromInclusive(InstanceContext, ECRecord)) {
+  switch (IsDerivedFromInclusive(ECRecord, InstanceContext)) {
   case AR_accessible: return AR_accessible;
   case AR_inaccessible: continue;
   case AR_dependent: OnFailure = AR_dependent; continue;

Thank you.

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

class cl
{
public:
   void myPublic(int x){ }
protected:
   void myProtected(int y){ }
};

class clChild : public cl
{
   void myPrivate(int z)
   {
  this->
 // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:13:13 %s -o - 
| FileCheck -check-prefix=CHECK-CC1 %s
 // CHECK: COMPLETION: myProtected : [#void#][#cl::#]myProtected(<#int 
y#>)
   }
};
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D31187: Fix removal of out-of-line definitions.

2017-03-21 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman added a comment.

Is it possible to test this change?


https://reviews.llvm.org/D31187



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


Re: FW: SemaAccess bug (protected members of derived)

2017-03-21 Thread Alex L via cfe-commits
Thanks, can you please attach a diff that includes both the code change and
the new test?

On 21 March 2017 at 14:18, Dixon Ryan (ETAS/ERS-PD2) via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Sending to mailing list.
>
>
>
> *From:* Dixon Ryan (ETAS/ERS-PD2)
> *Sent:* 21 March 2017 14:18
> *To:* 'Alex L' 
> *Subject:* RE: SemaAccess bug (protected members of derived)
>
>
>
> Hello, sorry this is the first time I have done this.
>
>
>
> The test case is attached. It should fail without the patch and then
> should pass with the patch.
>
>
>
>
>
> class cl
>
> {
>
> public:
>
>void myPublic(int x){ }
>
> protected:
>
>void myProtected(int y){ }
>
> };
>
>
>
> class clChild : public cl
>
> {
>
>void myPrivate(int z)
>
>{
>
>   this->
>
>  // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:13:13 %s
> -o - | FileCheck -check-prefix=CHECK-CC1 %s
>
>  // CHECK: COMPLETION: myProtected : [#void#][#cl::#]myProtected(<#int
> y#>)
>
>}
>
> };
>
>
>
>
>
> *From:* Alex L [mailto:arpha...@gmail.com ]
> *Sent:* 21 March 2017 12:17
> *To:* Dixon Ryan (ETAS/ERS-PD2) 
> *Cc:* cfe-commits@lists.llvm.org
> *Subject:* Re: SemaAccess bug (protected members of derived)
>
>
>
> Hi,
>
>
>
> Can you please add a suitable test-case? Clang's code-completion tests are
> normally in test/CodeCompletion or test/Index.
>
>
>
> Cheers,
>
> Alex
>
>
>
> On 21 March 2017 at 12:05, Dixon Ryan (ETAS/ERS-PD2) via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
> There are a number of users of the clang static analyser back-end for
> intelligent code completion. Irony-Mode for emacs, for example. For a while
> people have been reporting an issue with not getting completions for
> protected members of parent classes and I believe this patch solves the
> bug: simply that the arguments to IsDerivedFromInclusive were the wrong way
> around.
>
>
>
> URL: http://llvm.org/svn/llvm-project/cfe/trunk/lib/Sema
>
> Relative URL: ^/cfe/trunk/lib/Sema
>
>
>
> Index: SemaAccess.cpp
>
> ===
>
> --- SemaAccess.cpp  (revision 297956)
>
> +++ SemaAccess.cpp   (working copy)
>
> @@ -823,7 +823,7 @@
>
>  continue;
>
>}
>
> -  switch (IsDerivedFromInclusive(InstanceContext, ECRecord)) {
>
> +  switch (IsDerivedFromInclusive(ECRecord, InstanceContext)) {
>
>case AR_accessible: return AR_accessible;
>
>case AR_inaccessible: continue;
>
>case AR_dependent: OnFailure = AR_dependent; continue;
>
>
>
> Thank you.
>
>
> ___
> 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
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


RE: FW: SemaAccess bug (protected members of derived)

2017-03-21 Thread Dixon Ryan (ETAS/ERS-PD2) via cfe-commits
From path:

URL: http://llvm.org/svn/llvm-project/cfe/trunk
Relative URL: ^/cfe/trunk

From: Alex L [mailto:arpha...@gmail.com]
Sent: 21 March 2017 14:22
To: Dixon Ryan (ETAS/ERS-PD2) 
Cc: cfe-commits@lists.llvm.org
Subject: Re: FW: SemaAccess bug (protected members of derived)

Thanks, can you please attach a diff that includes both the code change and the 
new test?

On 21 March 2017 at 14:18, Dixon Ryan (ETAS/ERS-PD2) via cfe-commits 
mailto:cfe-commits@lists.llvm.org>> wrote:
Sending to mailing list.

From: Dixon Ryan (ETAS/ERS-PD2)
Sent: 21 March 2017 14:18
To: 'Alex L' mailto:arpha...@gmail.com>>
Subject: RE: SemaAccess bug (protected members of derived)

Hello, sorry this is the first time I have done this.

The test case is attached. It should fail without the patch and then should 
pass with the patch.


class cl
{
public:
   void myPublic(int x){ }
protected:
   void myProtected(int y){ }
};

class clChild : public cl
{
   void myPrivate(int z)
   {
  this->
 // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:13:13 %s -o - 
| FileCheck -check-prefix=CHECK-CC1 %s
 // CHECK: COMPLETION: myProtected : [#void#][#cl::#]myProtected(<#int 
y#>)
   }
};


From: Alex L [mailto:arpha...@gmail.com]
Sent: 21 March 2017 12:17
To: Dixon Ryan (ETAS/ERS-PD2) mailto:ryan.di...@etas.com>>
Cc: cfe-commits@lists.llvm.org
Subject: Re: SemaAccess bug (protected members of derived)

Hi,

Can you please add a suitable test-case? Clang's code-completion tests are 
normally in test/CodeCompletion or test/Index.

Cheers,
Alex

On 21 March 2017 at 12:05, Dixon Ryan (ETAS/ERS-PD2) via cfe-commits 
mailto:cfe-commits@lists.llvm.org>> wrote:
There are a number of users of the clang static analyser back-end for 
intelligent code completion. Irony-Mode for emacs, for example. For a while 
people have been reporting an issue with not getting completions for protected 
members of parent classes and I believe this patch solves the bug: simply that 
the arguments to IsDerivedFromInclusive were the wrong way around.

URL: http://llvm.org/svn/llvm-project/cfe/trunk/lib/Sema
Relative URL: ^/cfe/trunk/lib/Sema

Index: SemaAccess.cpp
===
--- SemaAccess.cpp  (revision 297956)
+++ SemaAccess.cpp   (working copy)
@@ -823,7 +823,7 @@
 continue;
   }
-  switch (IsDerivedFromInclusive(InstanceContext, ECRecord)) {
+  switch (IsDerivedFromInclusive(ECRecord, InstanceContext)) {
   case AR_accessible: return AR_accessible;
   case AR_inaccessible: continue;
   case AR_dependent: OnFailure = AR_dependent; continue;

Thank you.

___
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



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


[PATCH] D31187: Fix removal of out-of-line definitions.

2017-03-21 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev added a comment.

Not sure, this code is used by external tools. Maybe I could craft an example 
but it would be very complex, bringing half of the third party tool codebase...


https://reviews.llvm.org/D31187



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


[PATCH] D31187: Fix removal of out-of-line definitions.

2017-03-21 Thread Yaron Keren via Phabricator via cfe-commits
yaron.keren added a comment.

Could use dumpDeclContext() to test?


https://reviews.llvm.org/D31187



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


[PATCH] D30415: Fix -mno-altivec cannot overwrite -maltivec option

2017-03-21 Thread Sean Fertile via Phabricator via cfe-commits
sfertile added a comment.

> I have a patch to do this now. I'll plan on committing it in a bit.

Is there a way to mark the -f form of the option as deprecated? We should warn 
and suggest users switch to the -maltivec option for a release to give people a 
chance to update their builds.


https://reviews.llvm.org/D30415



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


[PATCH] D27627: [WIP] Supporting C++ based kernel languages on AMDGPU Target

2017-03-21 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl abandoned this revision.
yaxunl added a comment.

We consider to switch to use 0 as generic address space and abandon this since 
0 as generic address space is more agreeable to both LLVM and Clang's 
convention.


https://reviews.llvm.org/D27627



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


[PATCH] D30845: Fix array sizes where address space is not yet known

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






Comment at: lib/AST/ASTContext.cpp:2696
+  ArySize = ArySize.zextOrTrunc(
+  Target->getPreferredPointerWidth(getTargetAddressSpace(EltTy)));
 

Can we just use getMaxPointerWidth instead? If we cannot determine the pointer 
size, using max pointer size makes sense. Also can you add a ToDo comment about 
this. Ideally we could get a better fix later.


https://reviews.llvm.org/D30845



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


[PATCH] D31140: [LLVMbugs] [Bug 18710] Only generate .ARM.exidx and .ARM.extab when needed in EHABI

2017-03-21 Thread Jonathan Roelofs via Phabricator via cfe-commits
jroelofs added a comment.

Can you clarify the logic here? It's my understanding that:

`-fno-exceptions` does *not* imply `-fno-unwind-tables`

however:

`-fno-unwind-tables` *does* imply that exceptions cannot be used on targets 
that require the tables to do unwinding.


https://reviews.llvm.org/D31140



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


[PATCH] D31190: Publish RAIIObjectsForParser.h for external usage

2017-03-21 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev created this revision.

In the context of cling, we need to recover the parser from errors. This patch 
is essential for us and we would like to move it from our fork to clang proper.


Repository:
  rL LLVM

https://reviews.llvm.org/D31190

Files:
  lib/Parse/ParseCXXInlineMethods.cpp
  lib/Parse/ParseDecl.cpp
  lib/Parse/ParseDeclCXX.cpp
  lib/Parse/ParseExpr.cpp
  lib/Parse/ParseExprCXX.cpp
  lib/Parse/ParseInit.cpp
  lib/Parse/ParseObjc.cpp
  lib/Parse/ParseOpenMP.cpp
  lib/Parse/ParsePragma.cpp
  lib/Parse/ParseStmt.cpp
  lib/Parse/ParseStmtAsm.cpp
  lib/Parse/ParseTemplate.cpp
  lib/Parse/Parser.cpp
  lib/Parse/RAIIObjectsForParser.h

Index: lib/Parse/RAIIObjectsForParser.h
===
--- lib/Parse/RAIIObjectsForParser.h
+++ /dev/null
@@ -1,447 +0,0 @@
-//===--- RAIIObjectsForParser.h - RAII helpers for the parser ---*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===--===//
-//
-// This file defines and implements the some simple RAII objects that are used
-// by the parser to manage bits in recursion.
-//
-//===--===//
-
-#ifndef LLVM_CLANG_LIB_PARSE_RAIIOBJECTSFORPARSER_H
-#define LLVM_CLANG_LIB_PARSE_RAIIOBJECTSFORPARSER_H
-
-#include "clang/Parse/ParseDiagnostic.h"
-#include "clang/Parse/Parser.h"
-#include "clang/Sema/DelayedDiagnostic.h"
-#include "clang/Sema/Sema.h"
-
-namespace clang {
-  // TODO: move ParsingClassDefinition here.
-  // TODO: move TentativeParsingAction here.
-
-  /// \brief A RAII object used to temporarily suppress access-like
-  /// checking.  Access-like checks are those associated with
-  /// controlling the use of a declaration, like C++ access control
-  /// errors and deprecation warnings.  They are contextually
-  /// dependent, in that they can only be resolved with full
-  /// information about what's being declared.  They are also
-  /// suppressed in certain contexts, like the template arguments of
-  /// an explicit instantiation.  However, those suppression contexts
-  /// cannot necessarily be fully determined in advance;  for
-  /// example, something starting like this:
-  ///   template <> class std::vector
-  /// might be the entirety of an explicit instantiation:
-  ///   template <> class std::vector;
-  /// or just an elaborated type specifier:
-  ///   template <> class std::vector make_vector<>();
-  /// Therefore this class collects all the diagnostics and permits
-  /// them to be re-delayed in a new context.
-  class SuppressAccessChecks {
-Sema &S;
-sema::DelayedDiagnosticPool DiagnosticPool;
-Sema::ParsingDeclState State;
-bool Active;
-
-  public:
-/// Begin suppressing access-like checks 
-SuppressAccessChecks(Parser &P, bool activate = true)
-: S(P.getActions()), DiagnosticPool(nullptr) {
-  if (activate) {
-State = S.PushParsingDeclaration(DiagnosticPool);
-Active = true;
-  } else {
-Active = false;
-  }
-}
-SuppressAccessChecks(SuppressAccessChecks &&Other)
-  : S(Other.S), DiagnosticPool(std::move(Other.DiagnosticPool)),
-State(Other.State), Active(Other.Active) {
-  Other.Active = false;
-}
-void operator=(SuppressAccessChecks &&Other) = delete;
-
-void done() {
-  assert(Active && "trying to end an inactive suppression");
-  S.PopParsingDeclaration(State, nullptr);
-  Active = false;
-}
-
-void redelay() {
-  assert(!Active && "redelaying without having ended first");
-  if (!DiagnosticPool.pool_empty())
-S.redelayDiagnostics(DiagnosticPool);
-  assert(DiagnosticPool.pool_empty());
-}
-
-~SuppressAccessChecks() {
-  if (Active) done();
-}
-  };
-
-  /// \brief RAII object used to inform the actions that we're
-  /// currently parsing a declaration.  This is active when parsing a
-  /// variable's initializer, but not when parsing the body of a
-  /// class or function definition.
-  class ParsingDeclRAIIObject {
-Sema &Actions;
-sema::DelayedDiagnosticPool DiagnosticPool;
-Sema::ParsingDeclState State;
-bool Popped;
-
-ParsingDeclRAIIObject(const ParsingDeclRAIIObject &) = delete;
-void operator=(const ParsingDeclRAIIObject &) = delete;
-
-  public:
-enum NoParent_t { NoParent };
-ParsingDeclRAIIObject(Parser &P, NoParent_t _)
-: Actions(P.getActions()), DiagnosticPool(nullptr) {
-  push();
-}
-
-/// Creates a RAII object whose pool is optionally parented by another.
-ParsingDeclRAIIObject(Parser &P,
-  const sema::DelayedDiagnosticPool *parentPool)
-: Actions(P.getActions()), DiagnosticPool(parentPool) {
-  push();
-}
-
-/// 

RE: D30739: [OpenMP] "declare simd" for AArch64 Advanced SIMD.

2017-03-21 Thread Tian, Xinmin via cfe-commits
The current infrastructure for vector names generation works only for 
function definition. Ideally we should implement it also for function 
definition provided by external libraries

Right, we need to fix that  to support  #pragma omp declare simd on  function 
declaration as well to enable multiple module compilation via .h files for simd 
functions.  

Thanks,
Xinmin

-Original Message-
From: Francesco Petrogalli via Phabricator [mailto:revi...@reviews.llvm.org] 
Sent: Tuesday, March 21, 2017 6:13 AM
To: francesco.petroga...@arm.com; a.bat...@hotmail.com; cber...@us.ibm.com; 
acja...@us.ibm.com; hahnf...@itc.rwth-aachen.de
Cc: Tian, Xinmin ; florian.h...@arm.com; 
roger.ferreriba...@arm.com; amara.emer...@arm.com; renato.go...@linaro.org; 
cfe-commits@lists.llvm.org
Subject: [PATCH] D30739: [OpenMP] "declare simd" for AArch64 Advanced SIMD.

fpetrogalli added a comment.

In https://reviews.llvm.org/D30739#706292, @Hahnfeld wrote:

> In principal looks good to me although I'm not really familiar with this 
> part. Does that work for you if you have the `declare simd` in a header file 
> and the implementation in another file? On x86_64 I currently get:


The current infrastructure for vector names generation works only for function 
definition. Ideally we should implement it also for function definition 
provided by external libraries.

>   remark: loop not vectorized: call instruction cannot be vectorized
> 
> 
> But that seems to be a general problem inside LLVM's LoopVectorize pass...

AFAIK, none of the machinery required in LLVM to expose the mangled names in 
the vectorizer is present in trunk. There is a patch for x86 under review that 
does that: https://reviews.llvm.org/D22792


https://reviews.llvm.org/D30739



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


[PATCH] D31179: Objective-C categories should support attributes

2017-03-21 Thread Nathan Hawes via Phabricator via cfe-commits
nathawes accepted this revision.
nathawes added a comment.
This revision is now accepted and ready to land.

Thanks for this – looks good to me!


Repository:
  rL LLVM

https://reviews.llvm.org/D31179



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


[PATCH] D31179: Objective-C categories should support attributes

2017-03-21 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments.



Comment at: test/SemaObjC/attr-deprecated.m:124-128
+@interface A(Blah) // no warning
+- (A*)getA;
 @end
 
+@implementation A(Blah) // no warning

I would have assumed the use in the `@implementation` would have been enough to 
trigger it, is that not the behavior we'd want?

If not, can you extend the test to show that a use of the category triggers the 
deprecation warning? 


Repository:
  rL LLVM

https://reviews.llvm.org/D31179



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


r298391 - [Modules] Find PrivateHeaders when looking into subframeworks

2017-03-21 Thread Bruno Cardoso Lopes via cfe-commits
Author: bruno
Date: Tue Mar 21 11:43:51 2017
New Revision: 298391

URL: http://llvm.org/viewvc/llvm-project?rev=298391&view=rev
Log:
[Modules] Find PrivateHeaders when looking into subframeworks

Fix the current parsing of subframeworks in modulemaps to lookup for
headers based on whether they are frameworks.

rdar://problem/30563982

Added:
cfe/trunk/test/Modules/Inputs/Main.framework/
cfe/trunk/test/Modules/Inputs/Main.framework/Frameworks/
cfe/trunk/test/Modules/Inputs/Main.framework/Frameworks/Sub.framework/

cfe/trunk/test/Modules/Inputs/Main.framework/Frameworks/Sub.framework/Headers/

cfe/trunk/test/Modules/Inputs/Main.framework/Frameworks/Sub.framework/Headers/B.h

cfe/trunk/test/Modules/Inputs/Main.framework/Frameworks/Sub.framework/Headers/Sub.h

cfe/trunk/test/Modules/Inputs/Main.framework/Frameworks/Sub.framework/PrivateHeaders/

cfe/trunk/test/Modules/Inputs/Main.framework/Frameworks/Sub.framework/PrivateHeaders/BPriv.h

cfe/trunk/test/Modules/Inputs/Main.framework/Frameworks/Sub.framework/PrivateHeaders/SubPriv.h
cfe/trunk/test/Modules/Inputs/Main.framework/Headers/
cfe/trunk/test/Modules/Inputs/Main.framework/Headers/A.h
cfe/trunk/test/Modules/Inputs/Main.framework/Headers/Main.h
cfe/trunk/test/Modules/Inputs/Main.framework/Modules/
cfe/trunk/test/Modules/Inputs/Main.framework/Modules/module.modulemap

cfe/trunk/test/Modules/Inputs/Main.framework/Modules/module.private.modulemap
cfe/trunk/test/Modules/Inputs/Main.framework/PrivateHeaders/
cfe/trunk/test/Modules/Inputs/Main.framework/PrivateHeaders/APriv.h
cfe/trunk/test/Modules/Inputs/Main.framework/PrivateHeaders/MainPriv.h
cfe/trunk/test/Modules/find-privateheaders.m
Modified:
cfe/trunk/lib/Lex/ModuleMap.cpp

Modified: cfe/trunk/lib/Lex/ModuleMap.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/ModuleMap.cpp?rev=298391&r1=298390&r2=298391&view=diff
==
--- cfe/trunk/lib/Lex/ModuleMap.cpp (original)
+++ cfe/trunk/lib/Lex/ModuleMap.cpp Tue Mar 21 11:43:51 2017
@@ -1841,7 +1841,7 @@ void ModuleMapParser::parseHeaderDecl(MM
   Module::UnresolvedHeaderDirective Header;
   Header.FileName = Tok.getString();
   Header.FileNameLoc = consumeToken();
-  
+
   // Check whether we already have an umbrella.
   if (LeadingToken == MMToken::UmbrellaKeyword && ActiveModule->Umbrella) {
 Diags.Report(Header.FileNameLoc, diag::err_mmap_umbrella_clash)
@@ -1861,19 +1861,25 @@ void ModuleMapParser::parseHeaderDecl(MM
 // Search for the header file within the search directory.
 SmallString<128> FullPathName(Directory->getName());
 unsigned FullPathLength = FullPathName.size();
-
+
 if (ActiveModule->isPartOfFramework()) {
   appendSubframeworkPaths(ActiveModule, RelativePathName);
-  
+  unsigned RelativePathLength = RelativePathName.size();
+
   // Check whether this file is in the public headers.
   llvm::sys::path::append(RelativePathName, "Headers", Header.FileName);
   llvm::sys::path::append(FullPathName, RelativePathName);
   File = SourceMgr.getFileManager().getFile(FullPathName);
-  
+
+  // Check whether this file is in the private headers.
   if (!File) {
-// Check whether this file is in the private headers.
-// FIXME: Should we retain the subframework paths here?
-RelativePathName.clear();
+// Ideally, private modules in the form 'FrameworkName.Private' should
+// be defined as 'module FrameworkName.Private', and not as
+// 'framework module FrameworkName.Private', since a 
'Private.Framework'
+// does not usually exist. However, since both are currently widely 
used
+// for private modules, make sure we find the right path in both cases.
+RelativePathName.resize(ActiveModule->IsFramework ? 0
+  : 
RelativePathLength);
 FullPathName.resize(FullPathLength);
 llvm::sys::path::append(RelativePathName, "PrivateHeaders",
 Header.FileName);

Added: 
cfe/trunk/test/Modules/Inputs/Main.framework/Frameworks/Sub.framework/Headers/B.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/Main.framework/Frameworks/Sub.framework/Headers/B.h?rev=298391&view=auto
==
--- 
cfe/trunk/test/Modules/Inputs/Main.framework/Frameworks/Sub.framework/Headers/B.h
 (added)
+++ 
cfe/trunk/test/Modules/Inputs/Main.framework/Frameworks/Sub.framework/Headers/B.h
 Tue Mar 21 11:43:51 2017
@@ -0,0 +1 @@
+// B.h

Added: 
cfe/trunk/test/Modules/Inputs/Main.framework/Frameworks/Sub.framework/Headers/Sub.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/Main.framework/Frameworks/Sub.framework/Headers/Sub.h?rev=298391&view=auto

[PATCH] D31130: B32239 clang-tidy should not warn about array to pointer decay on system macros

2017-03-21 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM!


https://reviews.llvm.org/D31130



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


[PATCH] D30009: Add support for '#pragma clang attribute'

2017-03-21 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In https://reviews.llvm.org/D30009#706171, @arphaman wrote:

> I would be ok with that. We could merge `apply_to` and `apply_only_to` into a 
> single `apply_to` matching rule set specifier (it would behave like 
> `apply_only_to`).


That sounds sensible to me.

> I guess one downside would be is that it will become harder to fill out all 
> the match rules if one wants to apply an attribute to all possible 
> declarations. I suppose the attribute documentation generator can be updated 
> to include the full match rule set for each attribute instead of just yes/no 
> in the `#pragma clang attribute` documentation column.

Okay, so here's a possibly crazy idea (and it may be way too magical): what if 
`#pragma clang attribute push(foo)` generated the fix-it hint to suggest all of 
the targets the attribute can apply to? Alternatively, what if any malformed 
parsing of `#pragma clang attribute push(foo)` automatically do this? We know 
the user is trying to apply attributes to declarations, and we know which 
attribute they're trying for, so it somewhat stands to reason that the rest of 
the syntax can be supplied for them... and we need *something* in apply_to, so 
why not default to everything?


Repository:
  rL LLVM

https://reviews.llvm.org/D30009



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


[PATCH] D30739: [OpenMP] "declare simd" for AArch64 Advanced SIMD.

2017-03-21 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added a comment.

Guys, sorry for the delay with the reviews. I was on a vacation, now I'm on a 
relocation process. Will look at all patches as soon as possible, but not 
earlier than next week :( Sorry again.


https://reviews.llvm.org/D30739



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


[PATCH] D27627: [WIP] Supporting C++ based kernel languages on AMDGPU Target

2017-03-21 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

Okay.  That does seem more sensible than trying to change everything around the 
other way.


https://reviews.llvm.org/D27627



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


r298392 - [index/AST] Determine if a typedef shares a name and spelling location with its underlying tag type

2017-03-21 Thread Argyrios Kyrtzidis via cfe-commits
Author: akirtzidis
Date: Tue Mar 21 11:56:02 2017
New Revision: 298392

URL: http://llvm.org/viewvc/llvm-project?rev=298392&view=rev
Log:
[index/AST] Determine if a typedef shares a name and spelling location with its 
underlying tag type

In such a case, as when using the NS_ENUM macro, for indexing purposes treat 
the typedef as 'transparent',
meaning we treat its references as symbols of the underlying tag symbol.
Also provide a libclang API to check for such typedefs.

Modified:
cfe/trunk/include/clang-c/Index.h
cfe/trunk/include/clang/AST/Decl.h
cfe/trunk/lib/AST/Decl.cpp
cfe/trunk/lib/Index/IndexDecl.cpp
cfe/trunk/lib/Index/IndexTypeSourceInfo.cpp
cfe/trunk/test/Index/Core/index-source.m
cfe/trunk/test/Index/get-cursor.m
cfe/trunk/tools/c-index-test/c-index-test.c
cfe/trunk/tools/libclang/CXType.cpp
cfe/trunk/tools/libclang/libclang.exports

Modified: cfe/trunk/include/clang-c/Index.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=298392&r1=298391&r2=298392&view=diff
==
--- cfe/trunk/include/clang-c/Index.h (original)
+++ cfe/trunk/include/clang-c/Index.h Tue Mar 21 11:56:02 2017
@@ -3437,6 +3437,16 @@ CINDEX_LINKAGE long long clang_getArrayS
 CINDEX_LINKAGE CXType clang_Type_getNamedType(CXType T);
 
 /**
+ * \brief Determine if a typedef is 'transparent' tag.
+ *
+ * A typedef is considered 'transparent' if it shares a name and spelling
+ * location with its underlying tag type, as is the case with the NS_ENUM 
macro.
+ *
+ * \returns non-zero if transparent and zero otherwise.
+ */
+CINDEX_LINKAGE unsigned clang_Type_isTransparentTagTypedef(CXType T);
+
+/**
  * \brief List the possible error codes for \c clang_Type_getSizeOf,
  *   \c clang_Type_getAlignOf, \c clang_Type_getOffsetOf and
  *   \c clang_Cursor_getOffsetOf.

Modified: cfe/trunk/include/clang/AST/Decl.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=298392&r1=298391&r2=298392&view=diff
==
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Tue Mar 21 11:56:02 2017
@@ -2641,12 +2641,17 @@ class TypedefNameDecl : public TypeDecl,
   typedef std::pair ModedTInfo;
   llvm::PointerUnion MaybeModedTInfo;
 
+  // FIXME: This can be packed into the bitfields in Decl.
+  /// If 0, we have not computed IsTransparentTag.
+  /// Otherwise, IsTransparentTag is (CacheIsTransparentTag >> 1).
+  mutable unsigned CacheIsTransparentTag : 2;
+
 protected:
   TypedefNameDecl(Kind DK, ASTContext &C, DeclContext *DC,
   SourceLocation StartLoc, SourceLocation IdLoc,
   IdentifierInfo *Id, TypeSourceInfo *TInfo)
   : TypeDecl(DK, DC, IdLoc, Id, StartLoc), redeclarable_base(C),
-MaybeModedTInfo(TInfo) {}
+MaybeModedTInfo(TInfo), CacheIsTransparentTag(0) {}
 
   typedef Redeclarable redeclarable_base;
   TypedefNameDecl *getNextRedeclarationImpl() override {
@@ -2699,11 +2704,22 @@ public:
   /// this typedef declaration.
   TagDecl *getAnonDeclWithTypedefName(bool AnyRedecl = false) const;
 
+  /// Determines if this typedef shares a name and spelling location with its
+  /// underlying tag type, as is the case with the NS_ENUM macro.
+  bool isTransparentTag() const {
+if (CacheIsTransparentTag)
+  return CacheIsTransparentTag & 0x2;
+return isTransparentTagSlow();
+  }
+
   // Implement isa/cast/dyncast/etc.
   static bool classof(const Decl *D) { return classofKind(D->getKind()); }
   static bool classofKind(Kind K) {
 return K >= firstTypedefName && K <= lastTypedefName;
   }
+
+private:
+  bool isTransparentTagSlow() const;
 };
 
 /// TypedefDecl - Represents the declaration of a typedef-name via the 
'typedef'

Modified: cfe/trunk/lib/AST/Decl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=298392&r1=298391&r2=298392&view=diff
==
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Tue Mar 21 11:56:02 2017
@@ -4242,6 +4242,30 @@ TagDecl *TypedefNameDecl::getAnonDeclWit
   return nullptr;
 }
 
+bool TypedefNameDecl::isTransparentTagSlow() const {
+  auto determineIsTransparent = [&]() {
+if (auto *TT = getUnderlyingType()->getAs()) {
+  if (auto *TD = TT->getDecl()) {
+if (TD->getName() != getName())
+  return false;
+SourceLocation TTLoc = getLocation();
+SourceLocation TDLoc = TD->getLocation();
+if (!TTLoc.isMacroID() || !TDLoc.isMacroID())
+  return false;
+SourceManager &SM = getASTContext().getSourceManager();
+return SM.getSpellingLoc(TTLoc) == SM.getSpellingLoc(TDLoc);
+  }
+}
+return false;
+  };
+
+  bool isTransparent = determineIsTransparent();
+  CacheIsTransparentTag = 1;
+  i

r298394 - Update Clang for LLVM rename AttributeSet -> AttributeList

2017-03-21 Thread Reid Kleckner via cfe-commits
Author: rnk
Date: Tue Mar 21 11:57:30 2017
New Revision: 298394

URL: http://llvm.org/viewvc/llvm-project?rev=298394&view=rev
Log:
Update Clang for LLVM rename AttributeSet -> AttributeList

Modified:
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/lib/CodeGen/CGCXX.cpp
cfe/trunk/lib/CodeGen/CGCall.cpp
cfe/trunk/lib/CodeGen/CGCall.h
cfe/trunk/lib/CodeGen/CGDeclCXX.cpp
cfe/trunk/lib/CodeGen/CGException.cpp
cfe/trunk/lib/CodeGen/CGExpr.cpp
cfe/trunk/lib/CodeGen/CGExprCXX.cpp
cfe/trunk/lib/CodeGen/CGObjC.cpp
cfe/trunk/lib/CodeGen/CGObjCMac.cpp
cfe/trunk/lib/CodeGen/CGStmt.cpp
cfe/trunk/lib/CodeGen/CGVTables.cpp
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/lib/CodeGen/CodeGenModule.h
cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
cfe/trunk/lib/CodeGen/TargetInfo.cpp

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=298394&r1=298393&r2=298394&view=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Tue Mar 21 11:57:30 2017
@@ -598,9 +598,9 @@ Value *CodeGenFunction::EmitMSVCBuiltinE
 llvm::FunctionType *FTy = llvm::FunctionType::get(VoidTy, {Int32Ty}, 
false);
 llvm::InlineAsm *IA =
 llvm::InlineAsm::get(FTy, Asm, Constraints, /*SideEffects=*/true);
-llvm::AttributeSet NoReturnAttr =
-AttributeSet::get(getLLVMContext(), llvm::AttributeSet::FunctionIndex,
-  llvm::Attribute::NoReturn);
+llvm::AttributeList NoReturnAttr = llvm::AttributeList::get(
+getLLVMContext(), llvm::AttributeList::FunctionIndex,
+llvm::Attribute::NoReturn);
 CallSite CS = Builder.CreateCall(IA, EmitScalarExpr(E->getArg(0)));
 CS.setAttributes(NoReturnAttr);
 return CS.getInstruction();
@@ -2258,9 +2258,9 @@ RValue CodeGenFunction::EmitBuiltinExpr(
   case Builtin::BI_setjmpex: {
 if (getTarget().getTriple().isOSMSVCRT()) {
   llvm::Type *ArgTypes[] = {Int8PtrTy, Int8PtrTy};
-  llvm::AttributeSet ReturnsTwiceAttr =
-  AttributeSet::get(getLLVMContext(), 
llvm::AttributeSet::FunctionIndex,
-llvm::Attribute::ReturnsTwice);
+  llvm::AttributeList ReturnsTwiceAttr = llvm::AttributeList::get(
+  getLLVMContext(), llvm::AttributeList::FunctionIndex,
+  llvm::Attribute::ReturnsTwice);
   llvm::Constant *SetJmpEx = CGM.CreateRuntimeFunction(
   llvm::FunctionType::get(IntTy, ArgTypes, /*isVarArg=*/false),
   "_setjmpex", ReturnsTwiceAttr, /*Local=*/true);
@@ -2278,9 +2278,9 @@ RValue CodeGenFunction::EmitBuiltinExpr(
   }
   case Builtin::BI_setjmp: {
 if (getTarget().getTriple().isOSMSVCRT()) {
-  llvm::AttributeSet ReturnsTwiceAttr =
-  AttributeSet::get(getLLVMContext(), 
llvm::AttributeSet::FunctionIndex,
-llvm::Attribute::ReturnsTwice);
+  llvm::AttributeList ReturnsTwiceAttr = llvm::AttributeList::get(
+  getLLVMContext(), llvm::AttributeList::FunctionIndex,
+  llvm::Attribute::ReturnsTwice);
   llvm::Value *Buf = Builder.CreateBitOrPointerCast(
   EmitScalarExpr(E->getArg(0)), Int8PtrTy);
   llvm::CallSite CS;
@@ -2559,8 +2559,8 @@ RValue CodeGenFunction::EmitBuiltinExpr(
 
   AttrBuilder B;
   B.addAttribute(Attribute::ByVal);
-  AttributeSet ByValAttrSet =
-  AttributeSet::get(CGM.getModule().getContext(), 3U, B);
+  llvm::AttributeList ByValAttrSet =
+  llvm::AttributeList::get(CGM.getModule().getContext(), 3U, B);
 
   auto RTCall =
   Builder.CreateCall(CGM.CreateRuntimeFunction(FTy, Name, 
ByValAttrSet),
@@ -7995,9 +7995,9 @@ Value *CodeGenFunction::EmitX86BuiltinEx
 llvm::FunctionType *FTy = llvm::FunctionType::get(VoidTy, false);
 llvm::InlineAsm *IA =
 llvm::InlineAsm::get(FTy, "int $$0x2c", "", /*SideEffects=*/true);
-llvm::AttributeSet NoReturnAttr =
-AttributeSet::get(getLLVMContext(), llvm::AttributeSet::FunctionIndex,
-  llvm::Attribute::NoReturn);
+llvm::AttributeList NoReturnAttr = llvm::AttributeList::get(
+getLLVMContext(), llvm::AttributeList::FunctionIndex,
+llvm::Attribute::NoReturn);
 CallSite CS = Builder.CreateCall(IA);
 CS.setAttributes(NoReturnAttr);
 return CS.getInstruction();

Modified: cfe/trunk/lib/CodeGen/CGCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCXX.cpp?rev=298394&r1=298393&r2=298394&view=diff
==
--- cfe/trunk/lib/CodeGen/CGCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCXX.cpp Tue Mar 21 11:57:30 2017
@@ -256,7 +256,7 @@ llvm::Constant *CodeGenModule::getAddrOf
 
   return GetOrCreateLLVMFunction(
   getMangledName(GD), Fn

[PATCH] D31174: [X86][MS-compatability] allow MS TYPE/SIZE/LENGTH operators as a part of a compound expression

2017-03-21 Thread Reid Kleckner via Phabricator via cfe-commits
rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

lgtm


Repository:
  rL LLVM

https://reviews.llvm.org/D31174



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


[PATCH] D30415: Fix -mno-altivec cannot overwrite -maltivec option

2017-03-21 Thread Ulrich Weigand via Phabricator via cfe-commits
uweigand added a comment.

In https://reviews.llvm.org/D30415#705889, @echristo wrote:

> In https://reviews.llvm.org/D30415#705196, @uweigand wrote:
>
> > Well, mainline GCC doesn't have -faltivec at all and never had, I think 
> > this was only an Apple GCC extension ...  Not sure what exactly the 
> > semantics of that was.
>
>
> Sure it does and has for years. Check out rs6000/darwin.h :)
>
> FWIW: It turns on maltivec and adds a -include of altivec.h


Huh, I wasn't aware of that feature on Darwin, thanks for pointing it out ...

> Nearly all of the code in lib/Driver/ToolChains/Clang.cpp and 
> lib/Driver/ToolChains/Arch/PPC.cpp that deal with altivec. Simplifying the 
> interface by getting rid of needing to check multiple options.

But why would that code no longer be necessary for -maltivec?  Well, I guess 
I'll wait for your patch ...

If we indeed get rid of -faltivec, I'm wondering whether it would also make 
sense to get rid of -fzvector.  This is just an alias for -mzvector, and it 
isn't supported by GCC either.  I added it only because Richard Smith 
specifically asked for it when I contributed the feature here:
https://reviews.llvm.org/D11001

> This should be a -f flag, not a -m flag. (I think we only support -maltivec 
> for GCC compatibility.)




https://reviews.llvm.org/D30415



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


[PATCH] D30009: Add support for '#pragma clang attribute'

2017-03-21 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman added a comment.

In https://reviews.llvm.org/D30009#706515, @aaron.ballman wrote:

> In https://reviews.llvm.org/D30009#706171, @arphaman wrote:
>
> > I would be ok with that. We could merge `apply_to` and `apply_only_to` into 
> > a single `apply_to` matching rule set specifier (it would behave like 
> > `apply_only_to`).
>
>
> That sounds sensible to me.
>
> > I guess one downside would be is that it will become harder to fill out all 
> > the match rules if one wants to apply an attribute to all possible 
> > declarations. I suppose the attribute documentation generator can be 
> > updated to include the full match rule set for each attribute instead of 
> > just yes/no in the `#pragma clang attribute` documentation column.
>
> Okay, so here's a possibly crazy idea (and it may be way too magical): what 
> if `#pragma clang attribute push(foo)` generated the fix-it hint to suggest 
> all of the targets the attribute can apply to? Alternatively, what if any 
> malformed parsing of `#pragma clang attribute push(foo)` automatically do 
> this? We know the user is trying to apply attributes to declarations, and we 
> know which attribute they're trying for, so it somewhat stands to reason that 
> the rest of the syntax can be supplied for them... and we need *something* in 
> apply_to, so why not default to everything?


Something like that should work. Although we probably still want to have them 
in the documentation as well.


Repository:
  rL LLVM

https://reviews.llvm.org/D30009



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


r298410 - Correct class-template deprecation behavior

2017-03-21 Thread Erich Keane via cfe-commits
Author: erichkeane
Date: Tue Mar 21 12:49:17 2017
New Revision: 298410

URL: http://llvm.org/viewvc/llvm-project?rev=298410&view=rev
Log:
Correct class-template deprecation behavior

Based on the comment in the test, and my reading of the standard, a deprecated 
warning should be issued in the following case:
template [[deprecated]] class Foo{}; Foo f;

This was not the case, because the ClassTemplateSpecializationDecl creation did 
not also copy the deprecated attribute.

Note: I did NOT audit the complete set of attributes to see WHICH ones should 
be copied, so instead I simply copy ONLY the deprecated attribute.

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

Modified:
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
cfe/trunk/test/CXX/dcl.dcl/dcl.attr/dcl.attr.deprecated/p1.cpp
cfe/trunk/test/Sema/attr-deprecated.c
cfe/trunk/test/SemaCXX/attr-deprecated.cpp
cfe/trunk/test/SemaObjC/attr-deprecated.m
cfe/trunk/test/SemaObjC/special-dep-unavail-warning.m
cfe/trunk/test/SemaObjC/warn-deprecated-implementations.m
cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp

Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=298410&r1=298409&r2=298410&view=diff
==
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Tue Mar 21 12:49:17 2017
@@ -302,6 +302,9 @@ class Attr {
   // Set to true if this attribute can be duplicated on a subject when merging
   // attributes. By default, attributes are not merged.
   bit DuplicatesAllowedWhileMerging = 0;
+  // Set to true if this attribute is meaningful when applied to or inherited 
+  // in a class template definition.
+  bit MeaningfulToClassTemplateDefinition = 0;
   // Lists language options, one of which is required to be true for the
   // attribute to be applicable. If empty, no language options are required.
   list LangOpts = [];
@@ -373,6 +376,7 @@ def AbiTag : Attr {
   let Args = [VariadicStringArgument<"Tags">];
   let Subjects = SubjectList<[Struct, Var, Function, Namespace], ErrorDiag,
   "ExpectedStructClassVariableFunctionOrInlineNamespace">;
+  let MeaningfulToClassTemplateDefinition = 1;
   let Documentation = [AbiTagsDocs];
 }
 
@@ -805,6 +809,7 @@ def Deprecated : InheritableAttr {
   // An optional string argument that enables us to provide a
   // Fix-It.
   StringArgument<"Replacement", 1>];
+  let MeaningfulToClassTemplateDefinition = 1;
   let Documentation = [DeprecatedDocs];
 }
 
@@ -1723,6 +1728,7 @@ def Visibility : InheritableAttr {
   let Args = [EnumArgument<"Visibility", "VisibilityType",
["default", "hidden", "internal", "protected"],
["Default", "Hidden", "Hidden", "Protected"]>];
+  let MeaningfulToClassTemplateDefinition = 1;
   let Documentation = [Undocumented];
 }
 

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=298410&r1=298409&r2=298410&view=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Tue Mar 21 12:49:17 2017
@@ -7505,6 +7505,12 @@ public:
 LateInstantiatedAttrVec *LateAttrs = nullptr,
 LocalInstantiationScope *OuterMostScope = nullptr);
 
+  void
+  InstantiateAttrsForDecl(const MultiLevelTemplateArgumentList &TemplateArgs,
+  const Decl *Pattern, Decl *Inst,
+  LateInstantiatedAttrVec *LateAttrs = nullptr,
+  LocalInstantiationScope *OuterMostScope = nullptr);
+
   bool
   InstantiateClassTemplateSpecialization(SourceLocation PointOfInstantiation,
ClassTemplateSpecializationDecl *ClassTemplateSpec,

Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=298410&r1=298409&r2=298410&view=diff
==
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Tue Mar 21 12:49:17 2017
@@ -6723,6 +6723,7 @@ static void DoEmitAvailabilityWarning(Se
   // Diagnostics for deprecated or unavailable.
   unsigned diag, diag_message, diag_fwdclass_message;
   unsigned diag_available_here = diag::note_availability_specified_here;
+  SourceLocation NoteLocation = D->getLocation();
 
   // Matches 'diag::note_property_attribute' options.
   unsigned property_note_select;
@@ -6745,6 

[PATCH] D27486: Correct class-template deprecation behavior

2017-03-21 Thread Erich Keane via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL298410: Correct class-template deprecation behavior 
(authored by erichkeane).

Changed prior to commit:
  https://reviews.llvm.org/D27486?vs=84330&id=92514#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D27486

Files:
  cfe/trunk/include/clang/Basic/Attr.td
  cfe/trunk/include/clang/Sema/Sema.h
  cfe/trunk/lib/Sema/SemaDeclAttr.cpp
  cfe/trunk/lib/Sema/SemaTemplate.cpp
  cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
  cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
  cfe/trunk/test/CXX/dcl.dcl/dcl.attr/dcl.attr.deprecated/p1.cpp
  cfe/trunk/test/Sema/attr-deprecated.c
  cfe/trunk/test/SemaCXX/attr-deprecated.cpp
  cfe/trunk/test/SemaObjC/attr-deprecated.m
  cfe/trunk/test/SemaObjC/special-dep-unavail-warning.m
  cfe/trunk/test/SemaObjC/warn-deprecated-implementations.m
  cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp

Index: cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp
===
--- cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp
+++ cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp
@@ -2451,26 +2451,19 @@
   OS << "#endif  // ATTR_VISITOR_DECLS_ONLY\n";
 }
 
-// Emits code to instantiate dependent attributes on templates.
-void EmitClangAttrTemplateInstantiate(RecordKeeper &Records, raw_ostream &OS) {
-  emitSourceFileHeader("Template instantiation code for attributes", OS);
-
-  std::vector Attrs = Records.getAllDerivedDefinitions("Attr");
-
-  OS << "namespace clang {\n"
- << "namespace sema {\n\n"
- << "Attr *instantiateTemplateAttribute(const Attr *At, ASTContext &C, "
- << "Sema &S,\n"
- << "const MultiLevelTemplateArgumentList &TemplateArgs) {\n"
- << "  switch (At->getKind()) {\n";
+void EmitClangAttrTemplateInstantiateHelper(const std::vector &Attrs,
+raw_ostream &OS,
+bool AppliesToDecl) {
 
+  OS << "  switch (At->getKind()) {\n";
   for (const auto *Attr : Attrs) {
 const Record &R = *Attr;
 if (!R.getValueAsBit("ASTNode"))
   continue;
-
 OS << "case attr::" << R.getName() << ": {\n";
-bool ShouldClone = R.getValueAsBit("Clone");
+bool ShouldClone = R.getValueAsBit("Clone") &&
+   (!AppliesToDecl ||
+R.getValueAsBit("MeaningfulToClassTemplateDefinition"));
 
 if (!ShouldClone) {
   OS << "  return nullptr;\n";
@@ -2507,8 +2500,27 @@
   }
   OS << "  } // end switch\n"
  << "  llvm_unreachable(\"Unknown attribute!\");\n"
- << "  return nullptr;\n"
- << "}\n\n"
+ << "  return nullptr;\n";
+}
+
+// Emits code to instantiate dependent attributes on templates.
+void EmitClangAttrTemplateInstantiate(RecordKeeper &Records, raw_ostream &OS) {
+  emitSourceFileHeader("Template instantiation code for attributes", OS);
+
+  std::vector Attrs = Records.getAllDerivedDefinitions("Attr");
+
+  OS << "namespace clang {\n"
+ << "namespace sema {\n\n"
+ << "Attr *instantiateTemplateAttribute(const Attr *At, ASTContext &C, "
+ << "Sema &S,\n"
+ << "const MultiLevelTemplateArgumentList &TemplateArgs) {\n";
+  EmitClangAttrTemplateInstantiateHelper(Attrs, OS, /*AppliesToDecl*/false);
+  OS << "}\n\n"
+ << "Attr *instantiateTemplateAttributeForDecl(const Attr *At,\n"
+ << " ASTContext &C, Sema &S,\n"
+ << "const MultiLevelTemplateArgumentList &TemplateArgs) {\n";
+  EmitClangAttrTemplateInstantiateHelper(Attrs, OS, /*AppliesToDecl*/true);
+  OS << "}\n\n"
  << "} // end namespace sema\n"
  << "} // end namespace clang\n";
 }
Index: cfe/trunk/include/clang/Sema/Sema.h
===
--- cfe/trunk/include/clang/Sema/Sema.h
+++ cfe/trunk/include/clang/Sema/Sema.h
@@ -7505,6 +7505,12 @@
 LateInstantiatedAttrVec *LateAttrs = nullptr,
 LocalInstantiationScope *OuterMostScope = nullptr);
 
+  void
+  InstantiateAttrsForDecl(const MultiLevelTemplateArgumentList &TemplateArgs,
+  const Decl *Pattern, Decl *Inst,
+  LateInstantiatedAttrVec *LateAttrs = nullptr,
+  LocalInstantiationScope *OuterMostScope = nullptr);
+
   bool
   InstantiateClassTemplateSpecialization(SourceLocation PointOfInstantiation,
ClassTemplateSpecializationDecl *ClassTemplateSpec,
Index: cfe/trunk/include/clang/Basic/Attr.td
===
--- cfe/trunk/include/clang/Basic/Attr.td
+++ cfe/trunk/include/clang/Basic/Attr.td
@@ -302,6 +302,9 @@
   // Set to true if this attribute can be duplicated on a subject when merging
   // attributes. By default, attributes are not merged.
   bit DuplicatesAllowedWhileMerging = 0;
+  // Set to true if this attribute is meaningful when applied to or in

[PATCH] D31179: Objective-C categories should support attributes

2017-03-21 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman added inline comments.



Comment at: test/SemaObjC/attr-deprecated.m:124-128
+@interface A(Blah) // no warning
+- (A*)getA;
 @end
 
+@implementation A(Blah) // no warning

aaron.ballman wrote:
> I would have assumed the use in the `@implementation` would have been enough 
> to trigger it, is that not the behavior we'd want?
> 
> If not, can you extend the test to show that a use of the category triggers 
> the deprecation warning? 
I'm not sure. Typically an implementation of a category is located in a 
framework, so even if it's deprecated for the users of a framework, you 
wouldn't really want to get a warning about it when compiling that framework. 
That said there's is a non-default `-Wdeprecated-implementation` warning for 
class implementations, so I think it would make sense to use it for category 
implementations as well. I will add make sure that the warning is emitted when 
committing the patch.


Repository:
  rL LLVM

https://reviews.llvm.org/D31179



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


[PATCH] D31130: B32239 clang-tidy should not warn about array to pointer decay on system macros

2017-03-21 Thread Breno Rodrigues Guimaraes via Phabricator via cfe-commits
brenoguim marked 4 inline comments as done.
brenoguim added a comment.

Hi @aaron.ballman,

Thanks for the review!

I don't have rights to push this. Who should I contact to push the change in my 
behalf?


https://reviews.llvm.org/D31130



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


[PATCH] D31130: B32239 clang-tidy should not warn about array to pointer decay on system macros

2017-03-21 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment.

In https://reviews.llvm.org/D31130#706623, @brenoguim wrote:

> Hi @aaron.ballman,
>
> Thanks for the review!
>
> I don't have rights to push this. Who should I contact to push the change in 
> my behalf?


I'm happy to do so on your behalf (it'll happen later this afternoon unless 
someone else beats me to it).


https://reviews.llvm.org/D31130



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


Re: FW: SemaAccess bug (protected members of derived)

2017-03-21 Thread Alex L via cfe-commits
Thanks,

It looks like your solution isn't quite right as it causes Clang to accept
invalid access to protected members, e.g. as tested by
"test/CXX/class.access/class.protected/p1.cpp".

Do you think there's an alternative solution that you could use?

Alex

On 21 March 2017 at 14:48, Dixon Ryan (ETAS/ERS-PD2) 
wrote:

> From path:
>
>
>
> URL: http://llvm.org/svn/llvm-project/cfe/trunk
>
> Relative URL: ^/cfe/trunk
>
>
>
> *From:* Alex L [mailto:arpha...@gmail.com]
> *Sent:* 21 March 2017 14:22
> *To:* Dixon Ryan (ETAS/ERS-PD2) 
> *Cc:* cfe-commits@lists.llvm.org
> *Subject:* Re: FW: SemaAccess bug (protected members of derived)
>
>
>
> Thanks, can you please attach a diff that includes both the code change
> and the new test?
>
>
>
> On 21 March 2017 at 14:18, Dixon Ryan (ETAS/ERS-PD2) via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
> Sending to mailing list.
>
>
>
> *From:* Dixon Ryan (ETAS/ERS-PD2)
> *Sent:* 21 March 2017 14:18
> *To:* 'Alex L' 
> *Subject:* RE: SemaAccess bug (protected members of derived)
>
>
>
> Hello, sorry this is the first time I have done this.
>
>
>
> The test case is attached. It should fail without the patch and then
> should pass with the patch.
>
>
>
>
>
> class cl
>
> {
>
> public:
>
>void myPublic(int x){ }
>
> protected:
>
>void myProtected(int y){ }
>
> };
>
>
>
> class clChild : public cl
>
> {
>
>void myPrivate(int z)
>
>{
>
>   this->
>
>  // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:13:13 %s
> -o - | FileCheck -check-prefix=CHECK-CC1 %s
>
>  // CHECK: COMPLETION: myProtected : [#void#][#cl::#]myProtected(<#int
> y#>)
>
>}
>
> };
>
>
>
>
>
> *From:* Alex L [mailto:arpha...@gmail.com ]
> *Sent:* 21 March 2017 12:17
> *To:* Dixon Ryan (ETAS/ERS-PD2) 
> *Cc:* cfe-commits@lists.llvm.org
> *Subject:* Re: SemaAccess bug (protected members of derived)
>
>
>
> Hi,
>
>
>
> Can you please add a suitable test-case? Clang's code-completion tests are
> normally in test/CodeCompletion or test/Index.
>
>
>
> Cheers,
>
> Alex
>
>
>
> On 21 March 2017 at 12:05, Dixon Ryan (ETAS/ERS-PD2) via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
> There are a number of users of the clang static analyser back-end for
> intelligent code completion. Irony-Mode for emacs, for example. For a while
> people have been reporting an issue with not getting completions for
> protected members of parent classes and I believe this patch solves the
> bug: simply that the arguments to IsDerivedFromInclusive were the wrong way
> around.
>
>
>
> URL: http://llvm.org/svn/llvm-project/cfe/trunk/lib/Sema
>
> Relative URL: ^/cfe/trunk/lib/Sema
>
>
>
> Index: SemaAccess.cpp
>
> ===
>
> --- SemaAccess.cpp  (revision 297956)
>
> +++ SemaAccess.cpp   (working copy)
>
> @@ -823,7 +823,7 @@
>
>  continue;
>
>}
>
> -  switch (IsDerivedFromInclusive(InstanceContext, ECRecord)) {
>
> +  switch (IsDerivedFromInclusive(ECRecord, InstanceContext)) {
>
>case AR_accessible: return AR_accessible;
>
>case AR_inaccessible: continue;
>
>case AR_dependent: OnFailure = AR_dependent; continue;
>
>
>
> Thank you.
>
>
> ___
> 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
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D31130: B32239 clang-tidy should not warn about array to pointer decay on system macros

2017-03-21 Thread Breno Rodrigues Guimaraes via Phabricator via cfe-commits
brenoguim added a comment.

I appreciate it!


https://reviews.llvm.org/D31130



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


r298414 - Modules: Remove an invalid check in unit tests for r298278

2017-03-21 Thread Duncan P. N. Exon Smith via cfe-commits
Author: dexonsmith
Date: Tue Mar 21 13:26:18 2017
New Revision: 298414

URL: http://llvm.org/viewvc/llvm-project?rev=298414&view=rev
Log:
Modules: Remove an invalid check in unit tests for r298278

This is a fixup for the unit tests from r298278 (originally r298165).

Since the buffer that RawB2 pointed at was later deleted, a new call to
getBuffer may very well return a buffer at the same/old address.  Which is
fine.  Just delete the spurious check.

A Windows bot was occasionally hitting this in practice:
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/7086

Modified:
cfe/trunk/unittests/Basic/MemoryBufferCacheTest.cpp

Modified: cfe/trunk/unittests/Basic/MemoryBufferCacheTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Basic/MemoryBufferCacheTest.cpp?rev=298414&r1=298413&r2=298414&view=diff
==
--- cfe/trunk/unittests/Basic/MemoryBufferCacheTest.cpp (original)
+++ cfe/trunk/unittests/Basic/MemoryBufferCacheTest.cpp Tue Mar 21 13:26:18 2017
@@ -50,7 +50,6 @@ TEST(MemoryBufferCacheTest, addBuffer) {
 
   // Replace the middle buffer.
   B2 = getBuffer(2);
-  ASSERT_NE(RawB2, B2.get());
   RawB2 = B2.get();
   EXPECT_EQ(RawB2, &Cache.addBuffer("2", std::move(B2)));
 


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


[PATCH] D31134: [Serialization] Serialize DependentSizedExtVectorType

2017-03-21 Thread Bruno Cardoso Lopes via Phabricator via cfe-commits
bruno accepted this revision.
bruno added a comment.
This revision is now accepted and ready to land.

LGTM Alex, thanks!


Repository:
  rL LLVM

https://reviews.llvm.org/D31134



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


[libcxx] r298416 - Implement P0548: 'common_type and duration' This involves a subtle change in the return type of the unary +/- operators for std::chrono::duration, though I expect that no one will n

2017-03-21 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Tue Mar 21 13:38:57 2017
New Revision: 298416

URL: http://llvm.org/viewvc/llvm-project?rev=298416&view=rev
Log:
Implement P0548: 'common_type and duration' This involves a subtle change in 
the return type of the unary +/- operators for std::chrono::duration, though I 
expect that no one will notice.

Modified:
libcxx/trunk/include/chrono
libcxx/trunk/include/type_traits

libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp

libcxx/trunk/test/std/utilities/time/time.duration/time.duration.arithmetic/op_+.pass.cpp

libcxx/trunk/test/std/utilities/time/time.duration/time.duration.arithmetic/op_-.pass.cpp
libcxx/trunk/www/cxx1z_status.html

Modified: libcxx/trunk/include/chrono
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/chrono?rev=298416&r1=298415&r2=298416&view=diff
==
--- libcxx/trunk/include/chrono (original)
+++ libcxx/trunk/include/chrono Tue Mar 21 13:38:57 2017
@@ -48,7 +48,7 @@ class duration
 static_assert(Period::num > 0, "duration period must be positive");
 public:
 typedef Rep rep;
-typedef Period period;
+typedef typename _Period::type period;
 
 constexpr duration() = default;
 template 
@@ -75,8 +75,8 @@ public:
 
 // arithmetic
 
-constexpr duration  operator+() const;
-constexpr duration  operator-() const;
+constexpr common_type::type  operator+() const;
+constexpr common_type::type  operator-() const;
 constexpr duration& operator++();
 constexpr duration  operator++(int);
 constexpr duration& operator--();
@@ -523,7 +523,7 @@ class _LIBCPP_TEMPLATE_VIS duration
 
 public:
 typedef _Rep rep;
-typedef _Period period;
+typedef typename _Period::type period;
 private:
 rep __rep_;
 public:
@@ -565,8 +565,8 @@ public:
 
 // arithmetic
 
-_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration  operator+() const 
{return *this;}
-_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration  operator-() const 
{return duration(-__rep_);}
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR typename 
common_type::type operator+() const {return typename 
common_type::type(*this);}
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR typename 
common_type::type operator-() const {return typename 
common_type::type(-__rep_);}
 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 duration& 
operator++()  {++__rep_; return *this;}
 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 duration  
operator++(int)   {return duration(__rep_++);}
 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 duration& 
operator--()  {--__rep_; return *this;}

Modified: libcxx/trunk/include/type_traits
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/type_traits?rev=298416&r1=298415&r2=298416&view=diff
==
--- libcxx/trunk/include/type_traits (original)
+++ libcxx/trunk/include/type_traits Tue Mar 21 13:38:57 2017
@@ -1958,7 +1958,7 @@ template 
 struct _LIBCPP_TEMPLATE_VIS common_type<_Tp, void, void>
 {
 public:
-typedef typename decay<_Tp>::type type;
+typedef typename common_type<_Tp, _Tp>::type type;
 };
 
 template 
@@ -1981,7 +1981,7 @@ struct _LIBCPP_TEMPLATE_VIS common_type
 template 
 struct _LIBCPP_TEMPLATE_VIS common_type<_Tp>
 {
-typedef typename decay<_Tp>::type type;
+typedef typename common_type<_Tp, _Tp>::type type;
 };
 
 // bullet 3 - sizeof...(Tp) == 2

Modified: 
libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp?rev=298416&r1=298415&r2=298416&view=diff
==
--- 
libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp
 Tue Mar 21 13:38:57 2017
@@ -37,6 +37,12 @@ namespace std
   typedef S type;
 };
 
+//  P0548
+template 
+struct common_type< ::S, ::S > {
+  typedef S type;
+};
+
 template <> struct common_type< ::S, long> {};
 template <> struct common_type > {};
 }
@@ -284,4 +290,19 @@ int main()
   test_bullet_three_two();
   test_bullet_four();
 #endif
+
+//  P0548
+static_assert((std::is_same >::type, 
S >::value), "");
+static_assert((std::is_same, S >::type, 
S >::value), "");
+
+static_assert((std::is_same::type,
int>::value), "");
+static_assert((std::is_same::type,  
int>::value), "");
+static_assert((std::is_same::type,   
int>::value), "");
+static_assert((std::is_same::type, 
int>::value), "");
+
+static_assert((std::is_same::type, 
int>::val

[libcxx] r298418 - Add a bit more to one of the chrono tests

2017-03-21 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Tue Mar 21 13:40:46 2017
New Revision: 298418

URL: http://llvm.org/viewvc/llvm-project?rev=298418&view=rev
Log:
Add a bit more to one of the chrono tests

Modified:

libcxx/trunk/test/std/utilities/time/time.duration/time.duration.arithmetic/op_+.pass.cpp

Modified: 
libcxx/trunk/test/std/utilities/time/time.duration/time.duration.arithmetic/op_+.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/time/time.duration/time.duration.arithmetic/op_%2B.pass.cpp?rev=298418&r1=298417&r2=298418&view=diff
==
--- 
libcxx/trunk/test/std/utilities/time/time.duration/time.duration.arithmetic/op_+.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/time/time.duration/time.duration.arithmetic/op_+.pass.cpp
 Tue Mar 21 13:40:46 2017
@@ -32,4 +32,15 @@ int main()
 static_assert(m.count() == m2.count(), "");
 }
 #endif
+
+// P0548
+{
+typedef std::chrono::duration > D10;
+typedef std::chrono::duration > D1;
+D10 zero{0};
+D10 one{1};
+static_assert( (std::is_same< decltype(+one), decltype(zero-one) 
>::value), "");
+static_assert( (std::is_same< decltype(zero+one), D1>::value), "");
+static_assert( (std::is_same< decltype(+one), D1>::value), "");
+}
 }


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


[PATCH] D30810: Preserve vec3 type.

2017-03-21 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added a comment.



> Hi Anastasia, Bruno,
> 
> Do you still have other opinion? or Can we go ahead and commit this patch?

I would like to see this patch committed. I see clear evidence of it improving 
existing GPU targets in the master repo as well as outside of the main tree 
implementations. Bruno, do you have any more concerns?


https://reviews.llvm.org/D30810



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


[PATCH] D30810: Preserve vec3 type.

2017-03-21 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added a comment.

In https://reviews.llvm.org/D30810#699428, @Anastasia wrote:

> Would you be able to update ScalarExprEmitter::VisitAsTypeExpr implementation 
> accordingly to make things consistent?


Not sure it got lost somewhere... do you think you could address this too?


https://reviews.llvm.org/D30810



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


[PATCH] D30810: Preserve vec3 type.

2017-03-21 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia added a comment.

In https://reviews.llvm.org/D30810#706676, @Anastasia wrote:

> In https://reviews.llvm.org/D30810#699428, @Anastasia wrote:
>
> > Would you be able to update ScalarExprEmitter::VisitAsTypeExpr 
> > implementation accordingly to make things consistent?
>
>
> Not sure it got lost somewhere... do you think you could address this too?


I guess due to 4 element alignment the generated casts as vec4 should be fine 
for vec3, but it is worth checking...


https://reviews.llvm.org/D30810



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


[PATCH] D31153: Add the ability to use the children() range API in a const-correct manner

2017-03-21 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman updated this revision to Diff 92522.
aaron.ballman added a comment.

Missed a case for `UnaryExprOrTypeTraitExpr`.


https://reviews.llvm.org/D31153

Files:
  include/clang/AST/Expr.h
  include/clang/AST/StmtIterator.h
  lib/AST/Expr.cpp

Index: lib/AST/Expr.cpp
===
--- lib/AST/Expr.cpp
+++ lib/AST/Expr.cpp
@@ -3899,6 +3899,11 @@
   return child_range(&Argument.Ex, &Argument.Ex + 1);
 }
 
+Stmt::const_child_range UnaryExprOrTypeTraitExpr::children() const {
+  auto Children = const_cast(this)->children();
+  return const_child_range(Children.begin(), Children.end());
+}
+
 AtomicExpr::AtomicExpr(SourceLocation BLoc, ArrayRef args,
QualType t, AtomicOp op, SourceLocation RP)
   : Expr(AtomicExprClass, t, VK_RValue, OK_Ordinary,
Index: include/clang/AST/StmtIterator.h
===
--- include/clang/AST/StmtIterator.h
+++ include/clang/AST/StmtIterator.h
@@ -137,6 +137,10 @@
 
   ConstStmtIterator(const StmtIterator& RHS) :
 StmtIteratorImpl(RHS) {}
+
+  ConstStmtIterator(Stmt * const *S)
+  : StmtIteratorImpl(
+const_cast(S)) {}
 };
 
 } // end namespace clang
Index: include/clang/AST/Expr.h
===
--- include/clang/AST/Expr.h
+++ include/clang/AST/Expr.h
@@ -907,6 +907,10 @@
 return child_range(child_iterator(), child_iterator());
   }
 
+  const_child_range children() const {
+return const_child_range(const_child_iterator(), const_child_iterator());
+  }
+
   /// The source expression of an opaque value expression is the
   /// expression which originally generated the value.  This is
   /// provided as a convenience for analyses that don't wish to
@@ -1167,6 +1171,10 @@
 return child_range(child_iterator(), child_iterator());
   }
 
+  const_child_range children() const {
+return const_child_range(const_child_iterator(), const_child_iterator());
+  }
+
   friend TrailingObjects;
   friend class ASTStmtReader;
   friend class ASTStmtWriter;
@@ -1222,6 +1230,9 @@
 
   // Iterators
   child_range children() { return child_range(&FnName, &FnName + 1); }
+  const_child_range children() const {
+return const_child_range(&FnName, &FnName + 1);
+  }
 
   friend class ASTStmtReader;
 };
@@ -1315,6 +1326,9 @@
   child_range children() {
 return child_range(child_iterator(), child_iterator());
   }
+  const_child_range children() const {
+return const_child_range(const_child_iterator(), const_child_iterator());
+  }
 };
 
 class CharacterLiteral : public Expr {
@@ -1365,6 +1379,9 @@
   child_range children() {
 return child_range(child_iterator(), child_iterator());
   }
+  const_child_range children() const {
+return const_child_range(const_child_iterator(), const_child_iterator());
+  }
 };
 
 class FloatingLiteral : public Expr, private APFloatStorage {
@@ -1429,6 +1446,9 @@
   child_range children() {
 return child_range(child_iterator(), child_iterator());
   }
+  const_child_range children() const {
+return const_child_range(const_child_iterator(), const_child_iterator());
+  }
 };
 
 /// ImaginaryLiteral - We support imaginary integer and floating point literals,
@@ -1461,6 +1481,9 @@
 
   // Iterators
   child_range children() { return child_range(&Val, &Val+1); }
+  const_child_range children() const {
+return const_child_range(&Val, &Val + 1);
+  }
 };
 
 /// StringLiteral - This represents a string literal expression, e.g. "foo"
@@ -1628,6 +1651,9 @@
   child_range children() {
 return child_range(child_iterator(), child_iterator());
   }
+  const_child_range children() const {
+return const_child_range(const_child_iterator(), const_child_iterator());
+  }
 };
 
 /// ParenExpr - This represents a parethesized expression, e.g. "(1)".  This
@@ -1669,6 +1695,9 @@
 
   // Iterators
   child_range children() { return child_range(&Val, &Val+1); }
+  const_child_range children() const {
+return const_child_range(&Val, &Val + 1);
+  }
 };
 
 /// UnaryOperator - This represents the unary-expression's (except sizeof and
@@ -1778,6 +1807,9 @@
 
   // Iterators
   child_range children() { return child_range(&Val, &Val+1); }
+  const_child_range children() const {
+return const_child_range(&Val, &Val + 1);
+  }
 };
 
 /// Helper class for OffsetOfExpr.
@@ -1981,6 +2013,11 @@
 Stmt **begin = reinterpret_cast(getTrailingObjects());
 return child_range(begin, begin + NumExprs);
   }
+  const_child_range children() const {
+Stmt *const *begin =
+reinterpret_cast(getTrailingObjects());
+return const_child_range(begin, begin + NumExprs);
+  }
   friend TrailingObjects;
 };
 
@@ -2069,6 +2106,7 @@
 
   // Iterators
   child_range children();
+  const_child_range children() const;
 };
 
 //===--===//
@@ -2153,6 +2191,9 @@
   child_range ch

r298420 - Fix array sizes where address space is not yet known

2017-03-21 Thread Konstantin Zhuravlyov via cfe-commits
Author: kzhuravl
Date: Tue Mar 21 13:55:39 2017
New Revision: 298420

URL: http://llvm.org/viewvc/llvm-project?rev=298420&view=rev
Log:
Fix array sizes where address space is not yet known

For variables in generic address spaces, for example:

```
unsigned char V[6442450944];
...
```

the address space is not yet known when we get into
*getConstantArrayType*, it is 0. AMDGCN target's
address space 0 has 32 bits pointers, so when we
call *getPointerWidth* with 0, the array size is
trimmed to 32 bits, which is not right.

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

Added:
cfe/trunk/test/CodeGenOpenCL/amdgcn-large-globals.cl
Modified:
cfe/trunk/lib/AST/ASTContext.cpp

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=298420&r1=298419&r2=298420&view=diff
==
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Tue Mar 21 13:55:39 2017
@@ -2692,8 +2692,7 @@ QualType ASTContext::getConstantArrayTyp
   // Convert the array size into a canonical width matching the pointer size 
for
   // the target.
   llvm::APInt ArySize(ArySizeIn);
-  ArySize =
-ArySize.zextOrTrunc(Target->getPointerWidth(getTargetAddressSpace(EltTy)));
+  ArySize = ArySize.zextOrTrunc(Target->getMaxPointerWidth());
 
   llvm::FoldingSetNodeID ID;
   ConstantArrayType::Profile(ID, EltTy, ArySize, ASM, IndexTypeQuals);

Added: cfe/trunk/test/CodeGenOpenCL/amdgcn-large-globals.cl
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenOpenCL/amdgcn-large-globals.cl?rev=298420&view=auto
==
--- cfe/trunk/test/CodeGenOpenCL/amdgcn-large-globals.cl (added)
+++ cfe/trunk/test/CodeGenOpenCL/amdgcn-large-globals.cl Tue Mar 21 13:55:39 
2017
@@ -0,0 +1,12 @@
+// REQUIRES: amdgpu-registered-target
+// RUN: %clang_cc1 -cl-std=CL2.0 -triple amdgcn-unknown-unknown -S -emit-llvm 
-o - %s | FileCheck %s
+
+// CHECK: @One = common local_unnamed_addr addrspace(1) global [6442450944 x 
i8] zeroinitializer, align 1
+unsigned char One[6442450944];
+// CHECK: @Two = common local_unnamed_addr addrspace(1) global [6442450944 x 
i32] zeroinitializer, align 4
+global unsigned int Two[6442450944];
+ 
+kernel void large_globals(unsigned int id) {
+  One[id] = id;
+  Two[id + 1] = id + 1;
+}


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


[PATCH] D30845: Fix array sizes where address space is not yet known

2017-03-21 Thread Konstantin Zhuravlyov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
kzhuravl marked an inline comment as done.
Closed by commit rL298420: Fix array sizes where address space is not yet known 
(authored by kzhuravl).

Changed prior to commit:
  https://reviews.llvm.org/D30845?vs=91404&id=92523#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D30845

Files:
  cfe/trunk/lib/AST/ASTContext.cpp
  cfe/trunk/test/CodeGenOpenCL/amdgcn-large-globals.cl


Index: cfe/trunk/test/CodeGenOpenCL/amdgcn-large-globals.cl
===
--- cfe/trunk/test/CodeGenOpenCL/amdgcn-large-globals.cl
+++ cfe/trunk/test/CodeGenOpenCL/amdgcn-large-globals.cl
@@ -0,0 +1,12 @@
+// REQUIRES: amdgpu-registered-target
+// RUN: %clang_cc1 -cl-std=CL2.0 -triple amdgcn-unknown-unknown -S -emit-llvm 
-o - %s | FileCheck %s
+
+// CHECK: @One = common local_unnamed_addr addrspace(1) global [6442450944 x 
i8] zeroinitializer, align 1
+unsigned char One[6442450944];
+// CHECK: @Two = common local_unnamed_addr addrspace(1) global [6442450944 x 
i32] zeroinitializer, align 4
+global unsigned int Two[6442450944];
+ 
+kernel void large_globals(unsigned int id) {
+  One[id] = id;
+  Two[id + 1] = id + 1;
+}
Index: cfe/trunk/lib/AST/ASTContext.cpp
===
--- cfe/trunk/lib/AST/ASTContext.cpp
+++ cfe/trunk/lib/AST/ASTContext.cpp
@@ -2692,8 +2692,7 @@
   // Convert the array size into a canonical width matching the pointer size 
for
   // the target.
   llvm::APInt ArySize(ArySizeIn);
-  ArySize =
-ArySize.zextOrTrunc(Target->getPointerWidth(getTargetAddressSpace(EltTy)));
+  ArySize = ArySize.zextOrTrunc(Target->getMaxPointerWidth());
 
   llvm::FoldingSetNodeID ID;
   ConstantArrayType::Profile(ID, EltTy, ArySize, ASM, IndexTypeQuals);


Index: cfe/trunk/test/CodeGenOpenCL/amdgcn-large-globals.cl
===
--- cfe/trunk/test/CodeGenOpenCL/amdgcn-large-globals.cl
+++ cfe/trunk/test/CodeGenOpenCL/amdgcn-large-globals.cl
@@ -0,0 +1,12 @@
+// REQUIRES: amdgpu-registered-target
+// RUN: %clang_cc1 -cl-std=CL2.0 -triple amdgcn-unknown-unknown -S -emit-llvm -o - %s | FileCheck %s
+
+// CHECK: @One = common local_unnamed_addr addrspace(1) global [6442450944 x i8] zeroinitializer, align 1
+unsigned char One[6442450944];
+// CHECK: @Two = common local_unnamed_addr addrspace(1) global [6442450944 x i32] zeroinitializer, align 4
+global unsigned int Two[6442450944];
+ 
+kernel void large_globals(unsigned int id) {
+  One[id] = id;
+  Two[id + 1] = id + 1;
+}
Index: cfe/trunk/lib/AST/ASTContext.cpp
===
--- cfe/trunk/lib/AST/ASTContext.cpp
+++ cfe/trunk/lib/AST/ASTContext.cpp
@@ -2692,8 +2692,7 @@
   // Convert the array size into a canonical width matching the pointer size for
   // the target.
   llvm::APInt ArySize(ArySizeIn);
-  ArySize =
-ArySize.zextOrTrunc(Target->getPointerWidth(getTargetAddressSpace(EltTy)));
+  ArySize = ArySize.zextOrTrunc(Target->getMaxPointerWidth());
 
   llvm::FoldingSetNodeID ID;
   ConstantArrayType::Profile(ID, EltTy, ArySize, ASM, IndexTypeQuals);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r298421 - Prevent cppcoreguidelines-pro-bounds-array-to-pointer-decay from diagnosing array to pointer decay stemming from system macros.

2017-03-21 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Tue Mar 21 14:01:17 2017
New Revision: 298421

URL: http://llvm.org/viewvc/llvm-project?rev=298421&view=rev
Log:
Prevent cppcoreguidelines-pro-bounds-array-to-pointer-decay from diagnosing 
array to pointer decay stemming from system macros.

Patch by Breno Rodrigues Guimaraes.

Modified:

clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp

clang-tools-extra/trunk/test/clang-tidy/cppcoreguidelines-pro-bounds-array-to-pointer-decay.cpp

Modified: 
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp?rev=298421&r1=298420&r2=298421&view=diff
==
--- 
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp
 (original)
+++ 
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp
 Tue Mar 21 14:01:17 2017
@@ -47,6 +47,25 @@ AST_MATCHER_P(Expr, hasParentIgnoringImp
   return InnerMatcher.matches(*E, Finder, Builder);
 }
 
+AST_MATCHER(ImplicitCastExpr, isArrayToPointerDecay) {
+  return Node.getCastKind() == CK_ArrayToPointerDecay;
+}
+
+AST_MATCHER(ImplicitCastExpr, sysSymbolDecayInSysHeader) {
+  auto &SM = Finder->getASTContext().getSourceManager();
+  if (SM.isInSystemMacro(Node.getLocStart())) {
+if (isa(Node.getSubExpr()))
+  return true;
+
+if (const auto *SymbolDeclRef = dyn_cast(Node.getSubExpr())) {
+  const ValueDecl *SymbolDecl = SymbolDeclRef->getDecl();
+  if (SymbolDecl && SM.isInSystemHeader(SymbolDecl->getLocation()))
+return true;
+}
+  }
+  return false;
+}
+
 void ProBoundsArrayToPointerDecayCheck::registerMatchers(MatchFinder *Finder) {
   if (!getLangOpts().CPlusPlus)
 return;
@@ -56,10 +75,12 @@ void ProBoundsArrayToPointerDecayCheck::
   // 2) inside a range-for over an array
   // 3) if it converts a string literal to a pointer
   Finder->addMatcher(
-  implicitCastExpr(unless(hasParent(arraySubscriptExpr())),
+  implicitCastExpr(isArrayToPointerDecay(),
+   unless(hasParent(arraySubscriptExpr())),
unless(hasParentIgnoringImpCasts(explicitCastExpr())),
unless(isInsideOfRangeBeginEndStmt()),
-   unless(hasSourceExpression(stringLiteral(
+   unless(hasSourceExpression(stringLiteral())),
+   unless(sysSymbolDecayInSysHeader()))
   .bind("cast"),
   this);
 }
@@ -67,8 +88,6 @@ void ProBoundsArrayToPointerDecayCheck::
 void ProBoundsArrayToPointerDecayCheck::check(
 const MatchFinder::MatchResult &Result) {
   const auto *MatchedCast = Result.Nodes.getNodeAs("cast");
-  if (MatchedCast->getCastKind() != CK_ArrayToPointerDecay)
-return;
 
   diag(MatchedCast->getExprLoc(), "do not implicitly decay an array into a "
   "pointer; consider using gsl::array_view or "

Modified: 
clang-tools-extra/trunk/test/clang-tidy/cppcoreguidelines-pro-bounds-array-to-pointer-decay.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/cppcoreguidelines-pro-bounds-array-to-pointer-decay.cpp?rev=298421&r1=298420&r2=298421&view=diff
==
--- 
clang-tools-extra/trunk/test/clang-tidy/cppcoreguidelines-pro-bounds-array-to-pointer-decay.cpp
 (original)
+++ 
clang-tools-extra/trunk/test/clang-tidy/cppcoreguidelines-pro-bounds-array-to-pointer-decay.cpp
 Tue Mar 21 14:01:17 2017
@@ -1,4 +1,5 @@
 // RUN: %check_clang_tidy %s 
cppcoreguidelines-pro-bounds-array-to-pointer-decay %t
+#include 
 #include 
 
 namespace gsl {
@@ -34,6 +35,11 @@ void f() {
 
   for (auto &e : a) // OK, iteration internally decays array to pointer
 e = 1;
+
+  assert(false); // OK, array decay inside system header macro
+
+  assert(a);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not implicitly decay an array 
into a pointer; consider using gsl::array_view or an explicit cast instead 
[cppcoreguidelines-pro-bounds-array-to-pointer-decay]
 }
 
 const char *g() {


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


[PATCH] D31130: B32239 clang-tidy should not warn about array to pointer decay on system macros

2017-03-21 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman closed this revision.
aaron.ballman added a comment.

I've commit in r298421.


https://reviews.llvm.org/D31130



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


[libcxx] r298422 - Fix a couple of 'C++11'-isms from the last checkin, which broke the '03 bot.

2017-03-21 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Tue Mar 21 14:12:21 2017
New Revision: 298422

URL: http://llvm.org/viewvc/llvm-project?rev=298422&view=rev
Log:
Fix a couple of 'C++11'-isms from the last checkin, which broke the '03 bot.

Modified:
libcxx/trunk/include/type_traits

libcxx/trunk/test/std/utilities/time/time.duration/time.duration.arithmetic/op_+.pass.cpp

libcxx/trunk/test/std/utilities/time/time.duration/time.duration.arithmetic/op_-.pass.cpp

Modified: libcxx/trunk/include/type_traits
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/type_traits?rev=298422&r1=298421&r2=298422&view=diff
==
--- libcxx/trunk/include/type_traits (original)
+++ libcxx/trunk/include/type_traits Tue Mar 21 14:12:21 2017
@@ -1947,6 +1947,13 @@ template  using make_unsigned
 
 #ifdef _LIBCPP_HAS_NO_VARIADICS
 
+template <>
+struct _LIBCPP_TEMPLATE_VIS common_type
+{
+public:
+typedef void type;
+};
+
 template 
 struct _LIBCPP_TEMPLATE_VIS common_type
 {

Modified: 
libcxx/trunk/test/std/utilities/time/time.duration/time.duration.arithmetic/op_+.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/time/time.duration/time.duration.arithmetic/op_%2B.pass.cpp?rev=298422&r1=298421&r2=298422&view=diff
==
--- 
libcxx/trunk/test/std/utilities/time/time.duration/time.duration.arithmetic/op_+.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/time/time.duration/time.duration.arithmetic/op_+.pass.cpp
 Tue Mar 21 14:12:21 2017
@@ -37,8 +37,8 @@ int main()
 {
 typedef std::chrono::duration > D10;
 typedef std::chrono::duration > D1;
-D10 zero{0};
-D10 one{1};
+D10 zero(0);
+D10 one(1);
 static_assert( (std::is_same< decltype(+one), decltype(zero-one) 
>::value), "");
 static_assert( (std::is_same< decltype(zero+one), D1>::value), "");
 static_assert( (std::is_same< decltype(+one), D1>::value), "");

Modified: 
libcxx/trunk/test/std/utilities/time/time.duration/time.duration.arithmetic/op_-.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/time/time.duration/time.duration.arithmetic/op_-.pass.cpp?rev=298422&r1=298421&r2=298422&view=diff
==
--- 
libcxx/trunk/test/std/utilities/time/time.duration/time.duration.arithmetic/op_-.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/time/time.duration/time.duration.arithmetic/op_-.pass.cpp
 Tue Mar 21 14:12:21 2017
@@ -37,8 +37,8 @@ int main()
 {
 typedef std::chrono::duration > D10;
 typedef std::chrono::duration > D1;
-D10 zero{0};
-D10 one{1};
+D10 zero(0);
+D10 one(1);
 static_assert( (std::is_same< decltype(-one), decltype(zero-one) 
>::value), "");
 static_assert( (std::is_same< decltype(zero-one), D1>::value), "");
 static_assert( (std::is_same< decltype(-one), D1>::value), "");


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


r298424 - [CMake] fix CLANG_INCLUDE_DIRS CMake export

2017-03-21 Thread Guillaume Papin via cfe-commits
Author: papin_g
Date: Tue Mar 21 14:17:53 2017
New Revision: 298424

URL: http://llvm.org/viewvc/llvm-project?rev=298424&view=rev
Log:
[CMake] fix CLANG_INCLUDE_DIRS CMake export

Summary:
This change should fixes the export of CLANG_INCLUDE_DIRS variable in 
ClangConfig.cmake.

Unlike for the other variables, CLANG_INSTALL_PREFIX wasn't escaped meaning 
CLANG_INCLUDE_DIRS
resulting in the path "/include" instead of "${CLANG_INSTALL_PREFIX}/include".

Reviewers: beanz

Subscribers: mgorny

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

Modified:
cfe/trunk/cmake/modules/CMakeLists.txt

Modified: cfe/trunk/cmake/modules/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/cmake/modules/CMakeLists.txt?rev=298424&r1=298423&r2=298424&view=diff
==
--- cfe/trunk/cmake/modules/CMakeLists.txt (original)
+++ cfe/trunk/cmake/modules/CMakeLists.txt Tue Mar 21 14:17:53 2017
@@ -42,7 +42,7 @@ set(CLANG_CONFIG_CMAKE_DIR "\${CLANG_INS
 set(CLANG_CONFIG_LLVM_CMAKE_DIR 
"\${CLANG_INSTALL_PREFIX}/${LLVM_INSTALL_PACKAGE_DIR}")
 set(CLANG_CONFIG_EXPORTS_FILE "\${CLANG_CMAKE_DIR}/ClangTargets.cmake")
 set(CLANG_CONFIG_INCLUDE_DIRS
-  "${CLANG_INSTALL_PREFIX}/include"
+  "\${CLANG_INSTALL_PREFIX}/include"
   )
 configure_file(
   ${CMAKE_CURRENT_SOURCE_DIR}/ClangConfig.cmake.in


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


[PATCH] D31202: Clang change: Do not inline hot callsites for samplepgo in thinlto compile phase.

2017-03-21 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh created this revision.
Herald added subscribers: Prazek, mehdi_amini.

Because SamplePGO passes will be invoked twice in ThinLTO build: once at 
compile phase, the other at backend. We want to make sure the IR at the 2nd 
phase matches the hot part in pro
file, thus we do not want to inline hot callsites in the first phase.


https://reviews.llvm.org/D31202

Files:
  lib/CodeGen/BackendUtil.cpp
  test/CodeGen/Inputs/pgo-sample-thinlto-summary.prof
  test/CodeGen/pgo-sample-thinlto-summary.c


Index: test/CodeGen/pgo-sample-thinlto-summary.c
===
--- /dev/null
+++ test/CodeGen/pgo-sample-thinlto-summary.c
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=INLINE
+// RUN: %clang_cc1 -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=NOINLINE
+// Checks if hot call is inlined by normal compile, but not inlined by
+// thinlto compile.
+
+int baz(int);
+int g;
+
+void foo(int n) {
+  for (int i = 0; i < n; i++)
+g += baz(i);
+}
+
+// INLINE-NOT: call{{.*}}foo
+// NOINLINE: call{{.*}}foo
+void bar(int n) {
+  for (int i = 0; i < n; i++)
+foo(i);
+}
Index: test/CodeGen/Inputs/pgo-sample-thinlto-summary.prof
===
--- /dev/null
+++ test/CodeGen/Inputs/pgo-sample-thinlto-summary.prof
@@ -0,0 +1,2 @@
+bar:100:100
+ 2: 2000 foo:2000
Index: lib/CodeGen/BackendUtil.cpp
===
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -318,8 +318,13 @@
  !CodeGenOpts.DisableLifetimeMarkers);
 PMBuilder.Inliner = 
createAlwaysInlinerLegacyPass(InsertLifetimeIntrinsics);
   } else {
+// We do not want to inline hot callsites for SamplePGO module-summary 
build
+// because profile annotation will happen again in ThinLTO backend, and we
+// want the IR of the hot path to match the profile.
 PMBuilder.Inliner = createFunctionInliningPass(
-CodeGenOpts.OptimizationLevel, CodeGenOpts.OptimizeSize);
+CodeGenOpts.OptimizationLevel, CodeGenOpts.OptimizeSize,
+(!CodeGenOpts.SampleProfileFile.empty() &&
+ CodeGenOpts.EmitSummaryIndex));
   }
 
   PMBuilder.OptLevel = CodeGenOpts.OptimizationLevel;


Index: test/CodeGen/pgo-sample-thinlto-summary.c
===
--- /dev/null
+++ test/CodeGen/pgo-sample-thinlto-summary.c
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o - 2>&1 | FileCheck %s -check-prefix=INLINE
+// RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -flto=thin -o - 2>&1 | FileCheck %s -check-prefix=NOINLINE
+// Checks if hot call is inlined by normal compile, but not inlined by
+// thinlto compile.
+
+int baz(int);
+int g;
+
+void foo(int n) {
+  for (int i = 0; i < n; i++)
+g += baz(i);
+}
+
+// INLINE-NOT: call{{.*}}foo
+// NOINLINE: call{{.*}}foo
+void bar(int n) {
+  for (int i = 0; i < n; i++)
+foo(i);
+}
Index: test/CodeGen/Inputs/pgo-sample-thinlto-summary.prof
===
--- /dev/null
+++ test/CodeGen/Inputs/pgo-sample-thinlto-summary.prof
@@ -0,0 +1,2 @@
+bar:100:100
+ 2: 2000 foo:2000
Index: lib/CodeGen/BackendUtil.cpp
===
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -318,8 +318,13 @@
  !CodeGenOpts.DisableLifetimeMarkers);
 PMBuilder.Inliner = createAlwaysInlinerLegacyPass(InsertLifetimeIntrinsics);
   } else {
+// We do not want to inline hot callsites for SamplePGO module-summary build
+// because profile annotation will happen again in ThinLTO backend, and we
+// want the IR of the hot path to match the profile.
 PMBuilder.Inliner = createFunctionInliningPass(
-CodeGenOpts.OptimizationLevel, CodeGenOpts.OptimizeSize);
+CodeGenOpts.OptimizationLevel, CodeGenOpts.OptimizeSize,
+(!CodeGenOpts.SampleProfileFile.empty() &&
+ CodeGenOpts.EmitSummaryIndex));
   }
 
   PMBuilder.OptLevel = CodeGenOpts.OptimizationLevel;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D30415: Fix -mno-altivec cannot overwrite -maltivec option

2017-03-21 Thread Hal Finkel via cfe-commits


On 03/21/2017 12:19 PM, Ulrich Weigand via Phabricator wrote:

uweigand added a comment.

In https://reviews.llvm.org/D30415#705889, @echristo wrote:


In https://reviews.llvm.org/D30415#705196, @uweigand wrote:


Well, mainline GCC doesn't have -faltivec at all and never had, I think this 
was only an Apple GCC extension ...  Not sure what exactly the semantics of 
that was.


Sure it does and has for years. Check out rs6000/darwin.h :)

FWIW: It turns on maltivec and adds a -include of altivec.h


Huh, I wasn't aware of that feature on Darwin, thanks for pointing it out ...


Nearly all of the code in lib/Driver/ToolChains/Clang.cpp and 
lib/Driver/ToolChains/Arch/PPC.cpp that deal with altivec. Simplifying the 
interface by getting rid of needing to check multiple options.

But why would that code no longer be necessary for -maltivec?  Well, I guess 
I'll wait for your patch ...

If we indeed get rid of -faltivec, I'm wondering whether it would also make 
sense to get rid of -fzvector.  This is just an alias for -mzvector, and it 
isn't supported by GCC either.  I added it only because Richard Smith 
specifically asked for it when I contributed the feature here:
https://reviews.llvm.org/D11001


Perhaps what consistency giveth, consistency shall taketh away.

 -Hal




This should be a -f flag, not a -m flag. (I think we only support -maltivec for 
GCC compatibility.)




https://reviews.llvm.org/D30415





--
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory

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


[PATCH] D31174: [X86][MS-compatability] allow MS TYPE/SIZE/LENGTH operators as a part of a compound expression

2017-03-21 Thread coby via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL298426: [X86][MS-compatability][clang] allow MS 
TYPE/SIZE/LENGTH operators as a part of… (authored by coby).

Changed prior to commit:
  https://reviews.llvm.org/D31174?vs=92437&id=92529#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D31174

Files:
  cfe/trunk/test/CodeGen/ms-inline-asm.c


Index: cfe/trunk/test/CodeGen/ms-inline-asm.c
===
--- cfe/trunk/test/CodeGen/ms-inline-asm.c
+++ cfe/trunk/test/CodeGen/ms-inline-asm.c
@@ -201,6 +201,8 @@
 // CHECK: mov eax, $$4
   __asm mov eax, LENGTH _bar
 // CHECK: mov eax, $$2
+  __asm mov eax, [eax + LENGTH foo * 4]
+// CHECK: mov eax, [eax + $$1 * $$4]
 
   __asm mov eax, TYPE foo
 // CHECK: mov eax, $$4
@@ -210,16 +212,21 @@
 // CHECK: mov eax, $$4
   __asm mov eax, TYPE _bar
 // CHECK: mov eax, $$1
+  __asm mov eax, [eax + TYPE foo * 4]
+// CHECK: mov eax, [eax + $$4 * $$4]
 
   __asm mov eax, SIZE foo
 // CHECK: mov eax, $$4
   __asm mov eax, SIZE bar
 // CHECK: mov eax, $$1
   __asm mov eax, SIZE _foo
 // CHECK: mov eax, $$16
+  __asm mov eax, [eax + SIZE _foo * 4]
+// CHECK: mov eax, [eax + $$16 * $$4]
   __asm mov eax, SIZE _bar
 // CHECK: mov eax, $$2
 // CHECK: "~{eax},~{dirflag},~{fpsr},~{flags}"()
+
 }
 
 void t21() {


Index: cfe/trunk/test/CodeGen/ms-inline-asm.c
===
--- cfe/trunk/test/CodeGen/ms-inline-asm.c
+++ cfe/trunk/test/CodeGen/ms-inline-asm.c
@@ -201,6 +201,8 @@
 // CHECK: mov eax, $$4
   __asm mov eax, LENGTH _bar
 // CHECK: mov eax, $$2
+  __asm mov eax, [eax + LENGTH foo * 4]
+// CHECK: mov eax, [eax + $$1 * $$4]
 
   __asm mov eax, TYPE foo
 // CHECK: mov eax, $$4
@@ -210,16 +212,21 @@
 // CHECK: mov eax, $$4
   __asm mov eax, TYPE _bar
 // CHECK: mov eax, $$1
+  __asm mov eax, [eax + TYPE foo * 4]
+// CHECK: mov eax, [eax + $$4 * $$4]
 
   __asm mov eax, SIZE foo
 // CHECK: mov eax, $$4
   __asm mov eax, SIZE bar
 // CHECK: mov eax, $$1
   __asm mov eax, SIZE _foo
 // CHECK: mov eax, $$16
+  __asm mov eax, [eax + SIZE _foo * 4]
+// CHECK: mov eax, [eax + $$16 * $$4]
   __asm mov eax, SIZE _bar
 // CHECK: mov eax, $$2
 // CHECK: "~{eax},~{dirflag},~{fpsr},~{flags}"()
+
 }
 
 void t21() {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r298426 - [X86][MS-compatability][clang] allow MS TYPE/SIZE/LENGTH operators as a part of a compound expression

2017-03-21 Thread Coby Tayree via cfe-commits
Author: coby
Date: Tue Mar 21 14:33:32 2017
New Revision: 298426

URL: http://llvm.org/viewvc/llvm-project?rev=298426&view=rev
Log:
[X86][MS-compatability][clang] allow MS TYPE/SIZE/LENGTH operators as a part of 
a compound expression

This patch introduces X86AsmParser with the ability to handle the 
aforementioned ops within compound "MS" arithmetical expressions.
Currently - only supported as a stand alone Operand, e.g.:
"TYPE X"
now allowed :
"4 + TYPE X * 128"

LLVM side: https://reviews.llvm.org/D31173
Differential Revision: https://reviews.llvm.org/D31174

Modified:
cfe/trunk/test/CodeGen/ms-inline-asm.c

Modified: cfe/trunk/test/CodeGen/ms-inline-asm.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ms-inline-asm.c?rev=298426&r1=298425&r2=298426&view=diff
==
--- cfe/trunk/test/CodeGen/ms-inline-asm.c (original)
+++ cfe/trunk/test/CodeGen/ms-inline-asm.c Tue Mar 21 14:33:32 2017
@@ -201,6 +201,8 @@ void t20() {
 // CHECK: mov eax, $$4
   __asm mov eax, LENGTH _bar
 // CHECK: mov eax, $$2
+  __asm mov eax, [eax + LENGTH foo * 4]
+// CHECK: mov eax, [eax + $$1 * $$4]
 
   __asm mov eax, TYPE foo
 // CHECK: mov eax, $$4
@@ -210,6 +212,8 @@ void t20() {
 // CHECK: mov eax, $$4
   __asm mov eax, TYPE _bar
 // CHECK: mov eax, $$1
+  __asm mov eax, [eax + TYPE foo * 4]
+// CHECK: mov eax, [eax + $$4 * $$4]
 
   __asm mov eax, SIZE foo
 // CHECK: mov eax, $$4
@@ -217,9 +221,12 @@ void t20() {
 // CHECK: mov eax, $$1
   __asm mov eax, SIZE _foo
 // CHECK: mov eax, $$16
+  __asm mov eax, [eax + SIZE _foo * 4]
+// CHECK: mov eax, [eax + $$16 * $$4]
   __asm mov eax, SIZE _bar
 // CHECK: mov eax, $$2
 // CHECK: "~{eax},~{dirflag},~{fpsr},~{flags}"()
+
 }
 
 void t21() {


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


[PATCH] D31202: Clang change: Do not inline hot callsites for samplepgo in thinlto compile phase.

2017-03-21 Thread Teresa Johnson via Phabricator via cfe-commits
tejohnson accepted this revision.
tejohnson added a comment.
This revision is now accepted and ready to land.

LGTM


https://reviews.llvm.org/D31202



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


[PATCH] D31140: [LLVMbugs] [Bug 18710] Only generate .ARM.exidx and .ARM.extab when needed in EHABI

2017-03-21 Thread Christian Bruel via Phabricator via cfe-commits
chrib added a comment.

In https://reviews.llvm.org/D31140#706411, @jroelofs wrote:

> Can you clarify the logic here? It's my understanding that:
>
> `-fno-exceptions` does *not* imply `-fno-unwind-tables`
>
> however:
>
> `-fno-unwind-tables` *does* imply that exceptions cannot be used on targets 
> that require the tables to do unwinding.


Yes, (bad things might happen or (std::terminate will be called, or destructors 
not called.)...

But -f[no]-unwind-tables implies the UWTable attribute, not NoUwind attribute. 
To toggle NoUnwind, use -fno-exceptions

And this is getting worse with .canunwind which means DoesNotThrow :)

in my understanding,  the logic is as follow:

Since "An exception cannot propagate through a function with a nounwind table. 
The exception handling runtime environment terminates the program if it 
encounters a nounwind table during exception processing." (ARM Information 
Center)

The "nounwind" LLVM attribute, which means "Function does not throw" translates 
as the EXIDX_CANTUNWIND value in the exception table index table which needs to 
be created for the purpose (for the function)

And of course without exception runtime environment (the test here) we don't 
need this table. So I can see 3 cases:

- nounwind set :Generate .cantunwind directive and unwind 
table
- nounwind set but not EH   Do not generate the .cantunwind directive and do 
not emit the unwind table
- uwtable set Need to generate the unwind table (even 
without EH)

The  disable-arm-cantunwind flag means: without EH support if the function does 
not throw, do dot generate the exception tables and the EXIDX_CANTUNWIND value.


https://reviews.llvm.org/D31140



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


RE: r298410 - Correct class-template deprecation behavior

2017-03-21 Thread Yung, Douglas via cfe-commits
Hi Erich,

Your change is causing the Sema/attr-deprecated.c test to fail on the PS4 bot 
(http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/7087).
 Can you take a look?

Douglas Yung

> -Original Message-
> From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf Of
> Erich Keane via cfe-commits
> Sent: Tuesday, March 21, 2017 10:49
> To: cfe-commits@lists.llvm.org
> Subject: r298410 - Correct class-template deprecation behavior
> 
> Author: erichkeane
> Date: Tue Mar 21 12:49:17 2017
> New Revision: 298410
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=298410&view=rev
> Log:
> Correct class-template deprecation behavior
> 
> Based on the comment in the test, and my reading of the standard, a deprecated
> warning should be issued in the following case:
> template [[deprecated]] class Foo{}; Foo f;
> 
> This was not the case, because the ClassTemplateSpecializationDecl creation
> did not also copy the deprecated attribute.
> 
> Note: I did NOT audit the complete set of attributes to see WHICH ones should
> be copied, so instead I simply copy ONLY the deprecated attribute.
> 
> Differential Revision: https://reviews.llvm.org/D27486
> 
> Modified:
> cfe/trunk/include/clang/Basic/Attr.td
> cfe/trunk/include/clang/Sema/Sema.h
> cfe/trunk/lib/Sema/SemaDeclAttr.cpp
> cfe/trunk/lib/Sema/SemaTemplate.cpp
> cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
> cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
> cfe/trunk/test/CXX/dcl.dcl/dcl.attr/dcl.attr.deprecated/p1.cpp
> cfe/trunk/test/Sema/attr-deprecated.c
> cfe/trunk/test/SemaCXX/attr-deprecated.cpp
> cfe/trunk/test/SemaObjC/attr-deprecated.m
> cfe/trunk/test/SemaObjC/special-dep-unavail-warning.m
> cfe/trunk/test/SemaObjC/warn-deprecated-implementations.m
> cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp
> 
> Modified: cfe/trunk/include/clang/Basic/Attr.td
> URL: http://llvm.org/viewvc/llvm-
> project/cfe/trunk/include/clang/Basic/Attr.td?rev=298410&r1=298409&r2=298410&v
> iew=diff
> ==
> --- cfe/trunk/include/clang/Basic/Attr.td (original)
> +++ cfe/trunk/include/clang/Basic/Attr.td Tue Mar 21 12:49:17 2017
> @@ -302,6 +302,9 @@ class Attr {
>// Set to true if this attribute can be duplicated on a subject when
> merging
>// attributes. By default, attributes are not merged.
>bit DuplicatesAllowedWhileMerging = 0;
> +  // Set to true if this attribute is meaningful when applied to or
> + inherited  // in a class template definition.
> +  bit MeaningfulToClassTemplateDefinition = 0;
>// Lists language options, one of which is required to be true for the
>// attribute to be applicable. If empty, no language options are required.
>list LangOpts = [];
> @@ -373,6 +376,7 @@ def AbiTag : Attr {
>let Args = [VariadicStringArgument<"Tags">];
>let Subjects = SubjectList<[Struct, Var, Function, Namespace], ErrorDiag,
>"ExpectedStructClassVariableFunctionOrInlineNamespace">;
> +  let MeaningfulToClassTemplateDefinition = 1;
>let Documentation = [AbiTagsDocs];
>  }
> 
> @@ -805,6 +809,7 @@ def Deprecated : InheritableAttr {
>// An optional string argument that enables us to provide a
>// Fix-It.
>StringArgument<"Replacement", 1>];
> +  let MeaningfulToClassTemplateDefinition = 1;
>let Documentation = [DeprecatedDocs];  }
> 
> @@ -1723,6 +1728,7 @@ def Visibility : InheritableAttr {
>let Args = [EnumArgument<"Visibility", "VisibilityType",
> ["default", "hidden", "internal", "protected"],
> ["Default", "Hidden", "Hidden", "Protected"]>];
> +  let MeaningfulToClassTemplateDefinition = 1;
>let Documentation = [Undocumented];
>  }
> 
> 
> Modified: cfe/trunk/include/clang/Sema/Sema.h
> URL: http://llvm.org/viewvc/llvm-
> project/cfe/trunk/include/clang/Sema/Sema.h?rev=298410&r1=298409&r2=298410&vie
> w=diff
> ==
> --- cfe/trunk/include/clang/Sema/Sema.h (original)
> +++ cfe/trunk/include/clang/Sema/Sema.h Tue Mar 21 12:49:17 2017
> @@ -7505,6 +7505,12 @@ public:
>  LateInstantiatedAttrVec *LateAttrs = nullptr,
>  LocalInstantiationScope *OuterMostScope = nullptr);
> 
> +  void
> +  InstantiateAttrsForDecl(const MultiLevelTemplateArgumentList &TemplateArgs,
> +  const Decl *Pattern, Decl *Inst,
> +  LateInstantiatedAttrVec *LateAttrs = nullptr,
> +  LocalInstantiationScope *OuterMostScope =
> + nullptr);
> +
>bool
>InstantiateClassTemplateSpecialization(SourceLocation PointOfInstantiation,
> ClassTemplateSpecializationDecl
> *ClassTemplateSpec,
> 
> Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
> URL: htt

[PATCH] D28952: [analyzer] Add new Z3 constraint manager backend

2017-03-21 Thread Dominic Chen via Phabricator via cfe-commits
ddcc added inline comments.



Comment at: lib/StaticAnalyzer/Core/Z3ConstraintManager.cpp:60
+// Set timeout to 15000ms = 15s
+Z3_set_param_value(Config, "timeout", "15000");
+  }

xazax.hun wrote:
> Sorry for being a bit late in the party, I was wondering whether this timeout 
> can be a source of non-determinism. The constraint solver might get lucky or 
> unlucky based on the load or the underlying hardware to solve some of the 
> constraints. We might end up with different results over different runs which 
> can be confusing for the users. Is there any other way, to set something like 
> a timeout, like limiting the number of steps inside the solver?
I believe Z3 uses various heuristics internally, so the exact execution trace 
can differ between multiple executions. However, I don't believe that this 
would be a common issue, since queries on fixed-width bitvector are decidable. 
The 15 sec timeout is intended to prevent a single query from stalling the 
static analyzer; I've only experienced this with complex queries over 
floating-point types (e.g. D28953 + D28954 + D28955), which can degenerate to 
bitblasting. I don't have the exact numbers right now, but given that the 200+ 
tests in the testsuite complete in ~90 secs with this patch, the average time 
per test is < 0.5 sec, which includes tens if not hundreds of individual SMT 
queries. As far as I know, this timeout parameter is the only support 
configuration parameter. I'd also like to point out that this solver isn't used 
unless the user both builds with it and specifies it at runtime.


https://reviews.llvm.org/D28952



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


[PATCH] D31177: [ARC][ObjC++] Use ObjC semantic rules for comparisons between a pointer and objective-c object pointer

2017-03-21 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added inline comments.



Comment at: lib/Sema/SemaExpr.cpp:9431
+ ? 2
+ : 1)) {
   if (convertPointersToCompositeType(*this, Loc, LHS, RHS))

It wasn't clear to me why the code has to be added to the right hand side of 
the >= operator.

Is it equivalent to adding the following code, which I think is easier to 
understand? I'm assuming you are trying to avoid executing the statement when 
ObjCAutoRefCount is true and either LHSType or RHSType is an objc pointer type.

```
&& (!LangOpts.ObjCAutoRefCount || (!LHSType->isObjCObjectPointerType() && 
!RHSType->isObjCObjectPointerType()))
```


Repository:
  rL LLVM

https://reviews.llvm.org/D31177



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


r298429 - Clang change: Do not inline hot callsites for samplepgo in thinlto compile phase.

2017-03-21 Thread Dehao Chen via cfe-commits
Author: dehao
Date: Tue Mar 21 14:55:46 2017
New Revision: 298429

URL: http://llvm.org/viewvc/llvm-project?rev=298429&view=rev
Log:
Clang change: Do not inline hot callsites for samplepgo in thinlto compile 
phase.

Summary:
Because SamplePGO passes will be invoked twice in ThinLTO build: once at 
compile phase, the other at backend. We want to make sure the IR at the 2nd 
phase matches the hot part in pro
file, thus we do not want to inline hot callsites in the first phase.

Reviewers: tejohnson, eraman

Reviewed By: tejohnson

Subscribers: mehdi_amini, cfe-commits, Prazek

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

Added:
cfe/trunk/test/CodeGen/Inputs/pgo-sample-thinlto-summary.prof
cfe/trunk/test/CodeGen/pgo-sample-thinlto-summary.c
Modified:
cfe/trunk/lib/CodeGen/BackendUtil.cpp

Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=298429&r1=298428&r2=298429&view=diff
==
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Tue Mar 21 14:55:46 2017
@@ -318,8 +318,13 @@ void EmitAssemblyHelper::CreatePasses(le
  !CodeGenOpts.DisableLifetimeMarkers);
 PMBuilder.Inliner = 
createAlwaysInlinerLegacyPass(InsertLifetimeIntrinsics);
   } else {
+// We do not want to inline hot callsites for SamplePGO module-summary 
build
+// because profile annotation will happen again in ThinLTO backend, and we
+// want the IR of the hot path to match the profile.
 PMBuilder.Inliner = createFunctionInliningPass(
-CodeGenOpts.OptimizationLevel, CodeGenOpts.OptimizeSize);
+CodeGenOpts.OptimizationLevel, CodeGenOpts.OptimizeSize,
+(!CodeGenOpts.SampleProfileFile.empty() &&
+ CodeGenOpts.EmitSummaryIndex));
   }
 
   PMBuilder.OptLevel = CodeGenOpts.OptimizationLevel;

Added: cfe/trunk/test/CodeGen/Inputs/pgo-sample-thinlto-summary.prof
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/Inputs/pgo-sample-thinlto-summary.prof?rev=298429&view=auto
==
--- cfe/trunk/test/CodeGen/Inputs/pgo-sample-thinlto-summary.prof (added)
+++ cfe/trunk/test/CodeGen/Inputs/pgo-sample-thinlto-summary.prof Tue Mar 21 
14:55:46 2017
@@ -0,0 +1,2 @@
+bar:100:100
+ 2: 2000 foo:2000

Added: cfe/trunk/test/CodeGen/pgo-sample-thinlto-summary.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/pgo-sample-thinlto-summary.c?rev=298429&view=auto
==
--- cfe/trunk/test/CodeGen/pgo-sample-thinlto-summary.c (added)
+++ cfe/trunk/test/CodeGen/pgo-sample-thinlto-summary.c Tue Mar 21 14:55:46 2017
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm -o 
- 2>&1 | FileCheck %s -check-prefix=INLINE
+// RUN: %clang_cc1 -O2 
-fprofile-sample-use=%S/Inputs/pgo-sample-thinlto-summary.prof %s -emit-llvm 
-flto=thin -o - 2>&1 | FileCheck %s -check-prefix=NOINLINE
+// Checks if hot call is inlined by normal compile, but not inlined by
+// thinlto compile.
+
+int baz(int);
+int g;
+
+void foo(int n) {
+  for (int i = 0; i < n; i++)
+g += baz(i);
+}
+
+// INLINE-NOT: call{{.*}}foo
+// NOINLINE: call{{.*}}foo
+void bar(int n) {
+  for (int i = 0; i < n; i++)
+foo(i);
+}


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


[PATCH] D30954: Modules: Simulate diagnostic settings for implicit modules

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

Ping!


https://reviews.llvm.org/D30954



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


Re: [PATCH] D31140: [LLVMbugs] [Bug 18710] Only generate .ARM.exidx and .ARM.extab when needed in EHABI

2017-03-21 Thread Jonathan Roelofs via cfe-commits



On 3/21/17 1:53 PM, Christian Bruel via Phabricator wrote:

chrib added a comment.

In https://reviews.llvm.org/D31140#706411, @jroelofs wrote:


Can you clarify the logic here? It's my understanding that:

`-fno-exceptions` does *not* imply `-fno-unwind-tables`

however:

`-fno-unwind-tables` *does* imply that exceptions cannot be used on targets 
that require the tables to do unwinding.


Yes, (bad things might happen or (std::terminate will be called, or destructors 
not called.)...

But -f[no]-unwind-tables implies the UWTable attribute, not NoUwind attribute. 
To toggle NoUnwind, use -fno-exceptions

And this is getting worse with .canunwind which means DoesNotThrow :)

in my understanding,  the logic is as follow:

Since "An exception cannot propagate through a function with a nounwind table. The 
exception handling runtime environment terminates the program if it encounters a nounwind 
table during exception processing." (ARM Information Center)

The "nounwind" LLVM attribute, which means "Function does not throw" translates 
as the EXIDX_CANTUNWIND value in the exception table index table which needs to be created for the 
purpose (for the function)


I think the problem is here, actually. "nounwind" implies "does not 
throw", but "does not throw" really should not imply "nounwind". This is 
something that ought to be clarified in the langref with the addition of 
a "does not throw" attribute. Then the optimizer should be fixed to 
deduce "does not throw" instead of "nounwind", and we can let "nounwind" 
continue to imply .cantunwind.




And of course without exception runtime environment (the test here) we don't 
need this table. So I can see 3 cases:

- nounwind set :Generate .cantunwind directive and unwind 
table
- nounwind set but not EH   Do not generate the .cantunwind directive and do 
not emit the unwind table
- uwtable set Need to generate the unwind table (even 
without EH)

The  disable-arm-cantunwind flag means: without EH support if the function does 
not throw, do dot generate the exception tables and the EXIDX_CANTUNWIND value.


I'm not a big fan of this workaround flag. I'd rather see this fixed by 
clarifying/fixing the semantics of the IR.



Jon




https://reviews.llvm.org/D31140





--
Jon Roelofs
jonat...@codesourcery.com
CodeSourcery / Mentor Embedded

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


[PATCH] D31168: Set FMF for -ffp-contract=fast rather than a TargetConfig

2017-03-21 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment.

I think you can add a test case in this patch (after the llvm changes are 
checked in)?




Comment at: lib/CodeGen/CGExprScalar.cpp:262
+ApplyFPFeatures(llvm::IRBuilderBase &Builder, Expr *E)
+: CGBuilderTy::FastMathFlagGuard(Builder) {
+  if (const auto *BO = dyn_cast(E)) {

Is it necessary to check CXXOperatorCallExpr too here? 

Since CXXOperatorCallExpr has an FPFeatures field too, I was wondering how 
CodeGen was going to use that information.


https://reviews.llvm.org/D31168



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


RE: r298410 - Correct class-template deprecation behavior

2017-03-21 Thread Keane, Erich via cfe-commits
I saw that, I was digging into it, then went to lunch.  I'm hoping to push a 
fix by EOD if I can.

Thanks for the heads up though!

-Original Message-
From: Yung, Douglas [mailto:douglas.y...@sony.com] 
Sent: Tuesday, March 21, 2017 12:59 PM
To: Keane, Erich 
Cc: cfe-commits 
Subject: RE: r298410 - Correct class-template deprecation behavior

Hi Erich,

Your change is causing the Sema/attr-deprecated.c test to fail on the PS4 bot 
(http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/7087).
 Can you take a look?

Douglas Yung

> -Original Message-
> From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On 
> Behalf Of Erich Keane via cfe-commits
> Sent: Tuesday, March 21, 2017 10:49
> To: cfe-commits@lists.llvm.org
> Subject: r298410 - Correct class-template deprecation behavior
> 
> Author: erichkeane
> Date: Tue Mar 21 12:49:17 2017
> New Revision: 298410
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=298410&view=rev
> Log:
> Correct class-template deprecation behavior
> 
> Based on the comment in the test, and my reading of the standard, a 
> deprecated warning should be issued in the following case:
> template [[deprecated]] class Foo{}; Foo f;
> 
> This was not the case, because the ClassTemplateSpecializationDecl 
> creation did not also copy the deprecated attribute.
> 
> Note: I did NOT audit the complete set of attributes to see WHICH ones 
> should be copied, so instead I simply copy ONLY the deprecated attribute.
> 
> Differential Revision: https://reviews.llvm.org/D27486
> 
> Modified:
> cfe/trunk/include/clang/Basic/Attr.td
> cfe/trunk/include/clang/Sema/Sema.h
> cfe/trunk/lib/Sema/SemaDeclAttr.cpp
> cfe/trunk/lib/Sema/SemaTemplate.cpp
> cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
> cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
> cfe/trunk/test/CXX/dcl.dcl/dcl.attr/dcl.attr.deprecated/p1.cpp
> cfe/trunk/test/Sema/attr-deprecated.c
> cfe/trunk/test/SemaCXX/attr-deprecated.cpp
> cfe/trunk/test/SemaObjC/attr-deprecated.m
> cfe/trunk/test/SemaObjC/special-dep-unavail-warning.m
> cfe/trunk/test/SemaObjC/warn-deprecated-implementations.m
> cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp
> 
> Modified: cfe/trunk/include/clang/Basic/Attr.td
> URL: http://llvm.org/viewvc/llvm-
> project/cfe/trunk/include/clang/Basic/Attr.td?rev=298410&r1=298409&r2=
> 298410&v
> iew=diff
> ==
> 
> --- cfe/trunk/include/clang/Basic/Attr.td (original)
> +++ cfe/trunk/include/clang/Basic/Attr.td Tue Mar 21 12:49:17 2017
> @@ -302,6 +302,9 @@ class Attr {
>// Set to true if this attribute can be duplicated on a subject 
> when merging
>// attributes. By default, attributes are not merged.
>bit DuplicatesAllowedWhileMerging = 0;
> +  // Set to true if this attribute is meaningful when applied to or 
> + inherited  // in a class template definition.
> +  bit MeaningfulToClassTemplateDefinition = 0;
>// Lists language options, one of which is required to be true for the
>// attribute to be applicable. If empty, no language options are required.
>list LangOpts = [];
> @@ -373,6 +376,7 @@ def AbiTag : Attr {
>let Args = [VariadicStringArgument<"Tags">];
>let Subjects = SubjectList<[Struct, Var, Function, Namespace], ErrorDiag,
>"ExpectedStructClassVariableFunctionOrInlineNamespace">;
> +  let MeaningfulToClassTemplateDefinition = 1;
>let Documentation = [AbiTagsDocs];
>  }
> 
> @@ -805,6 +809,7 @@ def Deprecated : InheritableAttr {
>// An optional string argument that enables us to provide a
>// Fix-It.
>StringArgument<"Replacement", 1>];
> +  let MeaningfulToClassTemplateDefinition = 1;
>let Documentation = [DeprecatedDocs];  }
> 
> @@ -1723,6 +1728,7 @@ def Visibility : InheritableAttr {
>let Args = [EnumArgument<"Visibility", "VisibilityType",
> ["default", "hidden", "internal", "protected"],
> ["Default", "Hidden", "Hidden", 
> "Protected"]>];
> +  let MeaningfulToClassTemplateDefinition = 1;
>let Documentation = [Undocumented];  }
> 
> 
> Modified: cfe/trunk/include/clang/Sema/Sema.h
> URL: http://llvm.org/viewvc/llvm-
> project/cfe/trunk/include/clang/Sema/Sema.h?rev=298410&r1=298409&r2=29
> 8410&vie
> w=diff
> ==
> 
> --- cfe/trunk/include/clang/Sema/Sema.h (original)
> +++ cfe/trunk/include/clang/Sema/Sema.h Tue Mar 21 12:49:17 2017
> @@ -7505,6 +7505,12 @@ public:
>  LateInstantiatedAttrVec *LateAttrs = nullptr,
>  LocalInstantiationScope *OuterMostScope = 
> nullptr);
> 
> +  void
> +  InstantiateAttrsForDecl(const MultiLevelTemplateArgumentList &TemplateArgs,
> +  const Decl *Pattern, Decl *Inst,
> + 

r298431 - Let llvm.objectsize be conservative with null pointers

2017-03-21 Thread George Burgess IV via cfe-commits
Author: gbiv
Date: Tue Mar 21 15:09:35 2017
New Revision: 298431

URL: http://llvm.org/viewvc/llvm-project?rev=298431&view=rev
Log:
Let llvm.objectsize be conservative with null pointers

D28494 adds another parameter to @llvm.objectsize. Clang needs to be
sure to pass that third arg whenever applicable.

Modified:
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/lib/CodeGen/CGExpr.cpp
cfe/trunk/test/CodeGen/alloc-size.c
cfe/trunk/test/CodeGen/catch-undef-behavior.c
cfe/trunk/test/CodeGen/object-size.c
cfe/trunk/test/CodeGen/object-size.cpp
cfe/trunk/test/CodeGen/sanitize-recover.c

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=298431&r1=298430&r2=298431&view=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Tue Mar 21 15:09:35 2017
@@ -470,10 +470,13 @@ CodeGenFunction::emitBuiltinObjectSize(c
   assert(Ptr->getType()->isPointerTy() &&
  "Non-pointer passed to __builtin_object_size?");
 
-  // LLVM only supports 0 and 2, make sure that we pass along that as a 
boolean.
-  auto *CI = ConstantInt::get(Builder.getInt1Ty(), (Type & 2) >> 1);
   Value *F = CGM.getIntrinsic(Intrinsic::objectsize, {ResType, 
Ptr->getType()});
-  return Builder.CreateCall(F, {Ptr, CI});
+
+  // LLVM only supports 0 and 2, make sure that we pass along that as a 
boolean.
+  Value *Min = Builder.getInt1((Type & 2) != 0);
+  // For GCC compatability, __builtin_object_size treat NULL as unknown size.
+  Value *NullIsUnknown = Builder.getTrue();
+  return Builder.CreateCall(F, {Ptr, Min, NullIsUnknown});
 }
 
 // Many of MSVC builtins are on both x64 and ARM; to avoid repeating code, we

Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=298431&r1=298430&r2=298431&view=diff
==
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Tue Mar 21 15:09:35 2017
@@ -581,10 +581,11 @@ void CodeGenFunction::EmitTypeCheck(Type
 llvm::Type *Tys[2] = { IntPtrTy, Int8PtrTy };
 llvm::Value *F = CGM.getIntrinsic(llvm::Intrinsic::objectsize, Tys);
 llvm::Value *Min = Builder.getFalse();
+llvm::Value *NullIsUnknown = Builder.getFalse();
 llvm::Value *CastAddr = Builder.CreateBitCast(Ptr, Int8PtrTy);
-llvm::Value *LargeEnough =
-Builder.CreateICmpUGE(Builder.CreateCall(F, {CastAddr, Min}),
-  llvm::ConstantInt::get(IntPtrTy, Size));
+llvm::Value *LargeEnough = Builder.CreateICmpUGE(
+Builder.CreateCall(F, {CastAddr, Min, NullIsUnknown}),
+llvm::ConstantInt::get(IntPtrTy, Size));
 Checks.push_back(std::make_pair(LargeEnough, SanitizerKind::ObjectSize));
   }
 

Modified: cfe/trunk/test/CodeGen/alloc-size.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/alloc-size.c?rev=298431&r1=298430&r2=298431&view=diff
==
--- cfe/trunk/test/CodeGen/alloc-size.c (original)
+++ cfe/trunk/test/CodeGen/alloc-size.c Tue Mar 21 15:09:35 2017
@@ -231,7 +231,7 @@ void test7() {
 void test8() {
   // Non-const pointers aren't currently supported.
   void *buf = my_calloc(100, 5);
-  // CHECK: @llvm.objectsize.i64.p0i8(i8* %{{.*}}, i1 false)
+  // CHECK: @llvm.objectsize.i64.p0i8(i8* %{{.*}}, i1 false, i1 true)
   gi = __builtin_object_size(buf, 0);
   // CHECK: @llvm.objectsize
   gi = __builtin_object_size(buf, 1);

Modified: cfe/trunk/test/CodeGen/catch-undef-behavior.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/catch-undef-behavior.c?rev=298431&r1=298430&r2=298431&view=diff
==
--- cfe/trunk/test/CodeGen/catch-undef-behavior.c (original)
+++ cfe/trunk/test/CodeGen/catch-undef-behavior.c Tue Mar 21 15:09:35 2017
@@ -35,7 +35,7 @@ void foo() {
   union { int i; } u;
 
   // CHECK-COMMON:  %[[I8PTR:.*]] = bitcast i32* %[[PTR:.*]] to i8*
-  // CHECK-COMMON-NEXT: %[[SIZE:.*]] = call i64 @llvm.objectsize.i64.p0i8(i8* 
%[[I8PTR]], i1 false)
+  // CHECK-COMMON-NEXT: %[[SIZE:.*]] = call i64 @llvm.objectsize.i64.p0i8(i8* 
%[[I8PTR]], i1 false, i1 false)
   // CHECK-COMMON-NEXT: %[[CHECK0:.*]] = icmp uge i64 %[[SIZE]], 4
 
   // CHECK-COMMON:  %[[PTRTOINT:.*]] = ptrtoint {{.*}}* %[[PTR]] to i64

Modified: cfe/trunk/test/CodeGen/object-size.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/object-size.c?rev=298431&r1=298430&r2=298431&view=diff
==
--- cfe/trunk/test/CodeGen/object-size.c (original)
+++ cfe/trunk/test/CodeGen/object-size.c Tue Mar 21 15:09:35 2017
@@ -40,7 +40,7 @@ void test4() {
 // CHECK-LA

r298433 - iFix Test deprecation behavior in C89 mode as a result of r298410

2017-03-21 Thread Erich Keane via cfe-commits
Author: erichkeane
Date: Tue Mar 21 15:14:46 2017
New Revision: 298433

URL: http://llvm.org/viewvc/llvm-project?rev=298433&view=rev
Log:
iFix Test deprecation behavior in C89 mode as a result of r298410

Modified:
cfe/trunk/test/Sema/attr-deprecated.c

Modified: cfe/trunk/test/Sema/attr-deprecated.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-deprecated.c?rev=298433&r1=298432&r2=298433&view=diff
==
--- cfe/trunk/test/Sema/attr-deprecated.c (original)
+++ cfe/trunk/test/Sema/attr-deprecated.c Tue Mar 21 15:14:46 2017
@@ -1,4 +1,6 @@
 // RUN: %clang_cc1 %s -verify -fsyntax-only
+// RUN: %clang_cc1 %s -std=c99 -verify -fsyntax-only
+// RUN: %clang_cc1 %s -std=c89 -verify -fsyntax-only
 
 int f() __attribute__((deprecated)); // expected-note 2 {{'f' has been 
explicitly marked deprecated here}}
 void g() __attribute__((deprecated));// expected-note {{'g' has been 
explicitly marked deprecated here}}
@@ -121,11 +123,12 @@ struct test22 {
   __attribute((deprecated)) foo_dep e, f;
 };
 
-typedef int test23_ty __attribute((deprecated)); // expected-note 
{{'test23_ty' has been explicitly marked deprecated here}}
+typedef int test23_ty __attribute((deprecated)); 
 // Redefining a typedef is a C11 feature.
 #if __STDC_VERSION__ <= 199901L
 // expected-note@-3 {{'test23_ty' has been explicitly marked deprecated here}}
 #else
+// expected-note@-5 {{'test23_ty' has been explicitly marked deprecated here}}
 typedef int test23_ty; 
 #endif
 test23_ty test23_v; // expected-warning {{'test23_ty' is deprecated}}


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


[clang-tools-extra] r298434 - Don't make unqualified calls to functions that could well be found via

2017-03-21 Thread Chandler Carruth via cfe-commits
Author: chandlerc
Date: Tue Mar 21 15:15:42 2017
New Revision: 298434

URL: http://llvm.org/viewvc/llvm-project?rev=298434&view=rev
Log:
Don't make unqualified calls to functions that could well be found via
ADL as reasonable extension points.

All of this would be cleaner if this code followed the more usual LLVM
convention of not having deeply nested namespaces inside of .cpp files
and instead having a `using namespace ...;` at the top. Then the static
function would be in the global namespace and easily referred to as
`::join`. Instead we have to write a fairly contrived qualified name.
I figure the authors can clean this up with a less ambiguous name, using
the newly provided LLVM `join` function, or any other solution, but this
at least fixes the build.

Modified:

clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.cpp

Modified: 
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.cpp?rev=298434&r1=298433&r2=298434&view=diff
==
--- 
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.cpp
 (original)
+++ 
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.cpp
 Tue Mar 21 15:15:42 2017
@@ -182,8 +182,8 @@ void SpecialMemberFunctionsCheck::checkF
 
   if (!MissingMembers.empty())
 diag(ID.first, "class '%0' defines %1 but does not define %2")
-<< ID.second << join(DefinedMembers, " and ")
-<< join(MissingMembers, " or ");
+<< ID.second << cppcoreguidelines::join(DefinedMembers, " and ")
+<< cppcoreguidelines::join(MissingMembers, " or ");
 }
 
 } // namespace cppcoreguidelines


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


RE: r298410 - Correct class-template deprecation behavior

2017-03-21 Thread Keane, Erich via cfe-commits
Ended up being simpler than I expected.  I added -r298433  To fix this.  

The issue is that the test had a conditional based on the "C" version, so I 
explicitly added a test for C89 and C99, which the PS4 is apparently not 
defaulting to.

Thanks!
-Erich


-Original Message-
From: Yung, Douglas [mailto:douglas.y...@sony.com] 
Sent: Tuesday, March 21, 2017 12:59 PM
To: Keane, Erich 
Cc: cfe-commits 
Subject: RE: r298410 - Correct class-template deprecation behavior

Hi Erich,

Your change is causing the Sema/attr-deprecated.c test to fail on the PS4 bot 
(http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/7087).
 Can you take a look?

Douglas Yung

> -Original Message-
> From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On 
> Behalf Of Erich Keane via cfe-commits
> Sent: Tuesday, March 21, 2017 10:49
> To: cfe-commits@lists.llvm.org
> Subject: r298410 - Correct class-template deprecation behavior
> 
> Author: erichkeane
> Date: Tue Mar 21 12:49:17 2017
> New Revision: 298410
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=298410&view=rev
> Log:
> Correct class-template deprecation behavior
> 
> Based on the comment in the test, and my reading of the standard, a 
> deprecated warning should be issued in the following case:
> template [[deprecated]] class Foo{}; Foo f;
> 
> This was not the case, because the ClassTemplateSpecializationDecl 
> creation did not also copy the deprecated attribute.
> 
> Note: I did NOT audit the complete set of attributes to see WHICH ones 
> should be copied, so instead I simply copy ONLY the deprecated attribute.
> 
> Differential Revision: https://reviews.llvm.org/D27486
> 
> Modified:
> cfe/trunk/include/clang/Basic/Attr.td
> cfe/trunk/include/clang/Sema/Sema.h
> cfe/trunk/lib/Sema/SemaDeclAttr.cpp
> cfe/trunk/lib/Sema/SemaTemplate.cpp
> cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
> cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
> cfe/trunk/test/CXX/dcl.dcl/dcl.attr/dcl.attr.deprecated/p1.cpp
> cfe/trunk/test/Sema/attr-deprecated.c
> cfe/trunk/test/SemaCXX/attr-deprecated.cpp
> cfe/trunk/test/SemaObjC/attr-deprecated.m
> cfe/trunk/test/SemaObjC/special-dep-unavail-warning.m
> cfe/trunk/test/SemaObjC/warn-deprecated-implementations.m
> cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp
> 
> Modified: cfe/trunk/include/clang/Basic/Attr.td
> URL: http://llvm.org/viewvc/llvm-
> project/cfe/trunk/include/clang/Basic/Attr.td?rev=298410&r1=298409&r2=
> 298410&v
> iew=diff
> ==
> 
> --- cfe/trunk/include/clang/Basic/Attr.td (original)
> +++ cfe/trunk/include/clang/Basic/Attr.td Tue Mar 21 12:49:17 2017
> @@ -302,6 +302,9 @@ class Attr {
>// Set to true if this attribute can be duplicated on a subject 
> when merging
>// attributes. By default, attributes are not merged.
>bit DuplicatesAllowedWhileMerging = 0;
> +  // Set to true if this attribute is meaningful when applied to or 
> + inherited  // in a class template definition.
> +  bit MeaningfulToClassTemplateDefinition = 0;
>// Lists language options, one of which is required to be true for the
>// attribute to be applicable. If empty, no language options are required.
>list LangOpts = [];
> @@ -373,6 +376,7 @@ def AbiTag : Attr {
>let Args = [VariadicStringArgument<"Tags">];
>let Subjects = SubjectList<[Struct, Var, Function, Namespace], ErrorDiag,
>"ExpectedStructClassVariableFunctionOrInlineNamespace">;
> +  let MeaningfulToClassTemplateDefinition = 1;
>let Documentation = [AbiTagsDocs];
>  }
> 
> @@ -805,6 +809,7 @@ def Deprecated : InheritableAttr {
>// An optional string argument that enables us to provide a
>// Fix-It.
>StringArgument<"Replacement", 1>];
> +  let MeaningfulToClassTemplateDefinition = 1;
>let Documentation = [DeprecatedDocs];  }
> 
> @@ -1723,6 +1728,7 @@ def Visibility : InheritableAttr {
>let Args = [EnumArgument<"Visibility", "VisibilityType",
> ["default", "hidden", "internal", "protected"],
> ["Default", "Hidden", "Hidden", 
> "Protected"]>];
> +  let MeaningfulToClassTemplateDefinition = 1;
>let Documentation = [Undocumented];  }
> 
> 
> Modified: cfe/trunk/include/clang/Sema/Sema.h
> URL: http://llvm.org/viewvc/llvm-
> project/cfe/trunk/include/clang/Sema/Sema.h?rev=298410&r1=298409&r2=29
> 8410&vie
> w=diff
> ==
> 
> --- cfe/trunk/include/clang/Sema/Sema.h (original)
> +++ cfe/trunk/include/clang/Sema/Sema.h Tue Mar 21 12:49:17 2017
> @@ -7505,6 +7505,12 @@ public:
>  LateInstantiatedAttrVec *LateAttrs = nullptr,
>  LocalInstantiationScope *OuterMostScope = 
> nullptr);
> 
> +  void
> +  InstantiateAttrsForDecl(const MultiL

[PATCH] D30547: [clang-tidy] Forwarding reference overload in constructors

2017-03-21 Thread AndrĂ¡s Leitereg via Phabricator via cfe-commits
leanil updated this revision to Diff 92542.
leanil added a comment.

Suppress warning only on std::enable_if.
Make note on copy and move constructors.


Repository:
  rL LLVM

https://reviews.llvm.org/D30547

Files:
  clang-tidy/misc/CMakeLists.txt
  clang-tidy/misc/ForwardingReferenceOverloadCheck.cpp
  clang-tidy/misc/ForwardingReferenceOverloadCheck.h
  clang-tidy/misc/MiscTidyModule.cpp
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/misc-forwarding-reference-overload.rst
  test/clang-tidy/misc-forwarding-reference-overload.cpp

Index: test/clang-tidy/misc-forwarding-reference-overload.cpp
===
--- /dev/null
+++ test/clang-tidy/misc-forwarding-reference-overload.cpp
@@ -0,0 +1,105 @@
+// RUN: %check_clang_tidy %s misc-forwarding-reference-overload %t
+
+namespace std {
+template 
+struct enable_if {};
+
+template 
+struct enable_if { typedef T type; };
+
+template 
+using enable_if_t = typename enable_if::type;
+
+template 
+struct enable_if_nice { typedef T type; };
+}
+
+namespace foo {
+template 
+struct enable_if { typedef T type; };
+}
+
+template 
+constexpr bool just_true = true;
+
+class Person {
+public:
+  template 
+  Person(T &&n);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: constructor accepting a forwarding reference can hide copy and move constructors [misc-forwarding-reference-overload]
+
+  template 
+  Person(T &&n, int i = 5, ...);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: constructor accepting a forwarding reference can hide copy and move constructors [misc-forwarding-reference-overload]
+
+  template ::type>
+  Person(T &&n);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: constructor accepting a forwarding reference can hide copy and move constructors [misc-forwarding-reference-overload]
+
+  template 
+  Person(T &&n, typename foo::enable_if::type i = 5, ...);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: constructor accepting a forwarding reference can hide copy and move constructors [misc-forwarding-reference-overload]
+
+  Person(const Person &other) {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: note: copy constructor declared here
+
+  Person(Person &other) {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: note: copy constructor declared here
+
+  Person(Person &&other) {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: note: move constructor declared here
+};
+
+template 
+class Person2 {
+public:
+  // Two parameters without default value, can't act as copy / move constructor.
+  template 
+  Person2(T &&n, V &&m, int i = 5, ...);
+
+  // Guarded with enable_if.
+  template 
+  Person2(T &&n, int i = 5, std::enable_if_t a = 5, ...);
+
+  // Guarded with enable_if.
+  template ::type &>
+  Person2(T &&n);
+
+  // Guarded with enable_if.
+  template 
+  Person2(T &&n, typename std::enable_if>::type **a = nullptr);
+
+  // Guarded with enable_if.
+  template > *&&>
+  Person2(T &&n, double d = 0.0);
+
+  // Not a forwarding reference parameter.
+  template 
+  Person2(const T &&n);
+
+  // Not a forwarding reference parameter.
+  Person2(int &&x);
+
+  // Two parameters without default value, can't act as copy / move constructor.
+  template 
+  Person2(T &&n, int x);
+
+  // Not a forwarding reference parameter.
+  template 
+  Person2(U &&n);
+};
+
+// Copy and move constructors are both disabled.
+class Person3 {
+public:
+  template 
+  Person3(T &&n);
+
+  template 
+  Person3(T &&n, int I = 5, ...);
+
+  Person3(const Person3 &rhs) = delete;
+
+private:
+  Person3(Person3 &&rhs);
+};
Index: docs/clang-tidy/checks/misc-forwarding-reference-overload.rst
===
--- /dev/null
+++ docs/clang-tidy/checks/misc-forwarding-reference-overload.rst
@@ -0,0 +1,52 @@
+.. title:: clang-tidy - misc-forwarding-reference-overload
+
+misc-forwarding-reference-overload
+==
+
+The check looks for perfect forwarding constructors that can hide copy or move
+constructors. If a non const lvalue reference is passed to the constructor, the 
+forwarding reference parameter will be a better match than the const reference
+parameter of the copy constructor, so the perfect forwarding constructor will be
+called, which can be confusing.
+For detailed description of this issue see: Scott Meyers, Effective Modern C++,
+Item 26.
+
+Consider the following example:
+
+  .. code-block:: c++
+  
+class Person {
+public:
+  // C1: perfect forwarding ctor
+  template
+  explicit Person(T&& n) {}
+
+  // C2: perfect forwarding ctor with parameter default value
+  template
+  explicit Person(T&& n, int x = 1) {}
+  
+  // C3: perfect forwarding ctor guarded with enable_if
+  template,void>>
+  explicit Person(T&& n) {}
+  
+  // (possibly compiler generated) copy ctor
+  Person(const Person& rhs); 
+};
+
+The check warns for constructors C1 and C2, because those can hide cop

Re: r298392 - [index/AST] Determine if a typedef shares a name and spelling location with its underlying tag type

2017-03-21 Thread Vitaly Buka via cfe-commits
Could you please take a look at these leaks

http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/3606/steps/check-clang%20asan/logs/stdio


=
==32547==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 24 byte(s) in 1 object(s) allocated from:
#0 0x57a9a8 in __interceptor_malloc
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:64
#1 0x7f0c8c1de918 in clang::cxstring::createDup(llvm::StringRef)
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/tools/libclang/CXString.cpp:99:40
#2 0x7f0c8c1e1120 in clang_getTypeSpelling
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/tools/libclang/CXType.cpp:273:10
#3 0x5b5a53 in PrintCursor
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/tools/c-index-test/c-index-test.c:718:24
#4 0x5b4dc5 in FilteredPrintingVisitor
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/tools/c-index-test/c-index-test.c:1116:5
#5 0x7f0c8c115829 in
clang::cxcursor::CursorVisitor::Visit(CXCursor, bool)
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/tools/libclang/CIndex.cpp:209:11
#6 0x7f0c8c11d451 in
clang::cxcursor::CursorVisitor::handleDeclForVisitation(clang::Decl
const*) 
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/tools/libclang/CIndex.cpp:666:7
#7 0x7f0c8c11d9fb in
clang::cxcursor::CursorVisitor::VisitDeclContext(clang::DeclContext*)
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/tools/libclang/CIndex.cpp:627:30
#8 0x7f0c8c116ecf in
clang::cxcursor::CursorVisitor::VisitChildren(CXCursor)
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/tools/libclang/CIndex.cpp:532:20
#9 0x7f0c8c149ad6 in clang_visitChildren
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/tools/libclang/CIndex.cpp:4172:20
#10 0x5b8628 in perform_test_load
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/tools/c-index-test/c-index-test.c:1601:5
#11 0x5b8d4f in perform_test_load_source
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/tools/c-index-test/c-index-test.c:1697:12
#12 0x5c0e76 in cindextest_main
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/tools/c-index-test/c-index-test.c:4373:14
#13 0x5c5a1d in thread_runner
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/tools/c-index-test/c-index-test.c::25
#14 0x7f0c90a47daf in ExecuteOnThread_Dispatch(void*)
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/lib/Support/Unix/Threading.inc:53:3
#15 0x7f0c8919b6b9 in start_thread
(/lib/x86_64-linux-gnu/libpthread.so.0+0x76b9)

SUMMARY: AddressSanitizer: 24 byte(s) leaked in 1 allocation(s).

--



On Tue, Mar 21, 2017 at 10:08 AM Argyrios Kyrtzidis via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: akirtzidis
> Date: Tue Mar 21 11:56:02 2017
> New Revision: 298392
>
> URL: http://llvm.org/viewvc/llvm-project?rev=298392&view=rev
> Log:
> [index/AST] Determine if a typedef shares a name and spelling location
> with its underlying tag type
>
> In such a case, as when using the NS_ENUM macro, for indexing purposes
> treat the typedef as 'transparent',
> meaning we treat its references as symbols of the underlying tag symbol.
> Also provide a libclang API to check for such typedefs.
>
> Modified:
> cfe/trunk/include/clang-c/Index.h
> cfe/trunk/include/clang/AST/Decl.h
> cfe/trunk/lib/AST/Decl.cpp
> cfe/trunk/lib/Index/IndexDecl.cpp
> cfe/trunk/lib/Index/IndexTypeSourceInfo.cpp
> cfe/trunk/test/Index/Core/index-source.m
> cfe/trunk/test/Index/get-cursor.m
> cfe/trunk/tools/c-index-test/c-index-test.c
> cfe/trunk/tools/libclang/CXType.cpp
> cfe/trunk/tools/libclang/libclang.exports
>
> Modified: cfe/trunk/include/clang-c/Index.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=298392&r1=298391&r2=298392&view=diff
>
> ==
> --- cfe/trunk/include/clang-c/Index.h (original)
> +++ cfe/trunk/include/clang-c/Index.h Tue Mar 21 11:56:02 2017
> @@ -3437,6 +3437,16 @@ CINDEX_LINKAGE long long clang_getArrayS
>  CINDEX_LINKAGE CXType clang_Type_getNamedType(CXType T);
>
>  /**
> + * \brief Determine if a typedef is 'transparent' tag.
> + *
> + * A typedef is considered 'transparent' if it shares a name and spelling
> + * location with its underlying tag type, as is the case with the NS_ENUM
> macro.
> + *
> + * \returns non-zero if transparent and zero otherwise.
> + */
> +CINDEX_LINKAGE unsigned clang_Type_isTransparentTagTypedef(CXType T);
> +
> +/**
>   * \brie

[libcxx] r298438 - Fix test failure I introduced

2017-03-21 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Tue Mar 21 16:05:28 2017
New Revision: 298438

URL: http://llvm.org/viewvc/llvm-project?rev=298438&view=rev
Log:
Fix test failure I introduced

Modified:
libcxx/trunk/include/type_traits

Modified: libcxx/trunk/include/type_traits
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/type_traits?rev=298438&r1=298437&r2=298438&view=diff
==
--- libcxx/trunk/include/type_traits (original)
+++ libcxx/trunk/include/type_traits Tue Mar 21 16:05:28 2017
@@ -1947,18 +1947,18 @@ template  using make_unsigned
 
 #ifdef _LIBCPP_HAS_NO_VARIADICS
 
-template <>
-struct _LIBCPP_TEMPLATE_VIS common_type
+template 
+struct _LIBCPP_TEMPLATE_VIS common_type
 {
 public:
-typedef void type;
+typedef typename common_type::type, 
_Vp>::type type;
 };
 
-template 
-struct _LIBCPP_TEMPLATE_VIS common_type
+template <>
+struct _LIBCPP_TEMPLATE_VIS common_type
 {
 public:
-typedef typename common_type::type, 
_Vp>::type type;
+typedef void type;
 };
 
 template 


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


  1   2   >