Re: [PATCH] D9600: Add scan-build python implementation

2015-11-16 Thread Jonathan Roelofs via cfe-commits
jroelofs added a comment.

Thanks for re-uploading!



Comment at: tools/scan-build-py/README.md:39
@@ +38,3 @@
+
+$ python setup.py build
+$ python setup.py install

Mind adding a CMakeLists.txt to drive these from the clang build itself?


Comment at: tools/scan-build-py/libscanbuild/__init__.py:7
@@ +6,3 @@
+"""
+This module responsible to run the Clang static analyzer against any build
+and generate reports.

I think most of this block comment belongs in a new file: 
clang/docs/ScanBuild.rst


Comment at: tools/scan-build-py/tests/functional/src/build/Makefile:1
@@ +1,2 @@
+SRCDIR := ..
+OBJDIR := .

It'd probably be a good idea to structure these test inputs into their own 
"projects" so that support for more build system can be added later.

I'd suggest something like:

tools/scan-build-py/tests/functional/
simple_makefile
src
clean-one.c
broken-two.c
clean-one.c
clean-two.c
build
Makefile
cmake_makefiles
src
...
build
CMakeLists.txt
cmake_ninja
src
...
build
CMakeLists.txt


Comment at: tools/scan-build-py/tests/unit/__init__.py:16
@@ +15,3 @@
+
+def load_tests(loader, suite, pattern):
+suite.addTests(loader.loadTestsFromModule(test_command))

Mind hooking these up so that a LIT test harness can run them too? We use LIT 
to test pretty much everything else in the llvm project, and it'd be a shame to 
have a tool with a completely different way of running tests...


http://reviews.llvm.org/D9600



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


r253207 - Handle ARMv6KZ naming

2015-11-16 Thread Artyom Skrobov via cfe-commits
Author: askrobov
Date: Mon Nov 16 08:05:48 2015
New Revision: 253207

URL: http://llvm.org/viewvc/llvm-project?rev=253207=rev
Log:
Handle ARMv6KZ naming

Summary: Update for clang tests for D14568

Reviewers: rengolin, joerg, bogden

Subscribers: aemerson, rengolin, cfe-commits

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

Modified:
cfe/trunk/test/Driver/arm-cortex-cpus.c
cfe/trunk/test/Driver/biarch.c

Modified: cfe/trunk/test/Driver/arm-cortex-cpus.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/arm-cortex-cpus.c?rev=253207=253206=253207=diff
==
--- cfe/trunk/test/Driver/arm-cortex-cpus.c (original)
+++ cfe/trunk/test/Driver/arm-cortex-cpus.c Mon Nov 16 08:05:48 2015
@@ -73,11 +73,11 @@
 
 // RUN: %clang -target armv6k -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V6K %s
 // RUN: %clang -target arm -march=armv6k -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V6K %s
-// CHECK-V6K: "-cc1"{{.*}} "-triple" "armv6k-{{.*}} "-target-cpu" 
"arm1176jzf-s"
+// CHECK-V6K: "-cc1"{{.*}} "-triple" "armv6k-{{.*}} "-target-cpu" "arm1176j-s"
 
 // RUN: %clang -target armv6k -mthumb -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V6K-THUMB %s
 // RUN: %clang -target arm -march=armv6k -mthumb -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V6K-THUMB %s
-// CHECK-V6K-THUMB: "-cc1"{{.*}} "-triple" "thumbv6k-{{.*}} "-target-cpu" 
"arm1176jzf-s"
+// CHECK-V6K-THUMB: "-cc1"{{.*}} "-triple" "thumbv6k-{{.*}} "-target-cpu" 
"arm1176j-s"
 
 // RUN: %clang -target armv6t2 -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V6T2 %s
 // RUN: %clang -target arm -march=armv6t2 -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V6T2 %s
@@ -249,12 +249,14 @@
 // RUN: %clang -target arm-linux-gnueabi -mcpu=arm1136jf-s -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV6 %s
 // CHECK-CPUV6: "-cc1"{{.*}} "-triple" "armv6-{{.*}}
 
-// RUN: %clang -target arm-linux-gnueabi -mcpu=arm1176jz-s -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV6K %s
-// RUN: %clang -target arm-linux-gnueabi -mcpu=arm1176jzf-s -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV6K %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=mpcore -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV6K %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=mpcorenovfp -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV6K %s
 // CHECK-CPUV6K: "-cc1"{{.*}} "-triple" "armv6k-{{.*}}
 
+// RUN: %clang -target arm-linux-gnueabi -mcpu=arm1176jz-s -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV6KZ %s
+// RUN: %clang -target arm-linux-gnueabi -mcpu=arm1176jzf-s -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV6KZ %s
+// CHECK-CPUV6KZ: "-cc1"{{.*}} "-triple" "armv6kz-{{.*}}
+
 // RUN: %clang -target arm-linux-gnueabi -mcpu=arm1156t2-s -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV6T2 %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=arm1156t2f-s -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV6T2 %s
 // CHECK-CPUV6T2: "-cc1"{{.*}} "-triple" "armv6t2-{{.*}}

Modified: cfe/trunk/test/Driver/biarch.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/biarch.c?rev=253207=253206=253207=diff
==
--- cfe/trunk/test/Driver/biarch.c (original)
+++ cfe/trunk/test/Driver/biarch.c Mon Nov 16 08:05:48 2015
@@ -6,8 +6,9 @@
 // RUN: %clang -target x86_64--netbsd -m64 %s -### 2>&1 | FileCheck 
-check-prefix=X86_64 %s
 // X86_64: "-cc1" "-triple" "x86_64--netbsd"
 
+// r196538 set arm1176jzf-s as default CPU for ARMv6 on NetBSD
 // RUN: %clang -target armv6--netbsd-eabihf -m32 %s -### 2>&1 | FileCheck 
-check-prefix=ARMV6 %s
-// ARMV6: "-cc1" "-triple" "armv6k--netbsd-eabihf"
+// ARMV6: "-cc1" "-triple" "armv6kz--netbsd-eabihf"
 
 // RUN: %clang -target sparcv9--netbsd -m32 %s -### 2>&1 | FileCheck 
-check-prefix=SPARC %s
 // RUN: %clang -target sparc--netbsd -m32 %s -### 2>&1 | FileCheck 
-check-prefix=SPARC %s


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


Re: [PATCH] D14570: Handle ARMv6KZ naming

2015-11-16 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL253207: Handle ARMv6KZ naming (authored by askrobov).

Changed prior to commit:
  http://reviews.llvm.org/D14570?vs=39901=40280#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D14570

Files:
  cfe/trunk/test/Driver/arm-cortex-cpus.c
  cfe/trunk/test/Driver/biarch.c

Index: cfe/trunk/test/Driver/arm-cortex-cpus.c
===
--- cfe/trunk/test/Driver/arm-cortex-cpus.c
+++ cfe/trunk/test/Driver/arm-cortex-cpus.c
@@ -73,11 +73,11 @@
 
 // RUN: %clang -target armv6k -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V6K %s
 // RUN: %clang -target arm -march=armv6k -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V6K %s
-// CHECK-V6K: "-cc1"{{.*}} "-triple" "armv6k-{{.*}} "-target-cpu" 
"arm1176jzf-s"
+// CHECK-V6K: "-cc1"{{.*}} "-triple" "armv6k-{{.*}} "-target-cpu" "arm1176j-s"
 
 // RUN: %clang -target armv6k -mthumb -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V6K-THUMB %s
 // RUN: %clang -target arm -march=armv6k -mthumb -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V6K-THUMB %s
-// CHECK-V6K-THUMB: "-cc1"{{.*}} "-triple" "thumbv6k-{{.*}} "-target-cpu" 
"arm1176jzf-s"
+// CHECK-V6K-THUMB: "-cc1"{{.*}} "-triple" "thumbv6k-{{.*}} "-target-cpu" 
"arm1176j-s"
 
 // RUN: %clang -target armv6t2 -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V6T2 %s
 // RUN: %clang -target arm -march=armv6t2 -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V6T2 %s
@@ -249,12 +249,14 @@
 // RUN: %clang -target arm-linux-gnueabi -mcpu=arm1136jf-s -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV6 %s
 // CHECK-CPUV6: "-cc1"{{.*}} "-triple" "armv6-{{.*}}
 
-// RUN: %clang -target arm-linux-gnueabi -mcpu=arm1176jz-s -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV6K %s
-// RUN: %clang -target arm-linux-gnueabi -mcpu=arm1176jzf-s -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV6K %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=mpcore -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV6K %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=mpcorenovfp -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV6K %s
 // CHECK-CPUV6K: "-cc1"{{.*}} "-triple" "armv6k-{{.*}}
 
+// RUN: %clang -target arm-linux-gnueabi -mcpu=arm1176jz-s -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV6KZ %s
+// RUN: %clang -target arm-linux-gnueabi -mcpu=arm1176jzf-s -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV6KZ %s
+// CHECK-CPUV6KZ: "-cc1"{{.*}} "-triple" "armv6kz-{{.*}}
+
 // RUN: %clang -target arm-linux-gnueabi -mcpu=arm1156t2-s -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV6T2 %s
 // RUN: %clang -target arm-linux-gnueabi -mcpu=arm1156t2f-s -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-CPUV6T2 %s
 // CHECK-CPUV6T2: "-cc1"{{.*}} "-triple" "armv6t2-{{.*}}
Index: cfe/trunk/test/Driver/biarch.c
===
--- cfe/trunk/test/Driver/biarch.c
+++ cfe/trunk/test/Driver/biarch.c
@@ -6,8 +6,9 @@
 // RUN: %clang -target x86_64--netbsd -m64 %s -### 2>&1 | FileCheck 
-check-prefix=X86_64 %s
 // X86_64: "-cc1" "-triple" "x86_64--netbsd"
 
+// r196538 set arm1176jzf-s as default CPU for ARMv6 on NetBSD
 // RUN: %clang -target armv6--netbsd-eabihf -m32 %s -### 2>&1 | FileCheck 
-check-prefix=ARMV6 %s
-// ARMV6: "-cc1" "-triple" "armv6k--netbsd-eabihf"
+// ARMV6: "-cc1" "-triple" "armv6kz--netbsd-eabihf"
 
 // RUN: %clang -target sparcv9--netbsd -m32 %s -### 2>&1 | FileCheck 
-check-prefix=SPARC %s
 // RUN: %clang -target sparc--netbsd -m32 %s -### 2>&1 | FileCheck 
-check-prefix=SPARC %s


Index: cfe/trunk/test/Driver/arm-cortex-cpus.c
===
--- cfe/trunk/test/Driver/arm-cortex-cpus.c
+++ cfe/trunk/test/Driver/arm-cortex-cpus.c
@@ -73,11 +73,11 @@
 
 // RUN: %clang -target armv6k -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V6K %s
 // RUN: %clang -target arm -march=armv6k -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V6K %s
-// CHECK-V6K: "-cc1"{{.*}} "-triple" "armv6k-{{.*}} "-target-cpu" "arm1176jzf-s"
+// CHECK-V6K: "-cc1"{{.*}} "-triple" "armv6k-{{.*}} "-target-cpu" "arm1176j-s"
 
 // RUN: %clang -target armv6k -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V6K-THUMB %s
 // RUN: %clang -target arm -march=armv6k -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V6K-THUMB %s
-// CHECK-V6K-THUMB: "-cc1"{{.*}} "-triple" "thumbv6k-{{.*}} "-target-cpu" "arm1176jzf-s"
+// CHECK-V6K-THUMB: "-cc1"{{.*}} "-triple" "thumbv6k-{{.*}} "-target-cpu" "arm1176j-s"
 
 // RUN: %clang -target armv6t2 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V6T2 %s
 // RUN: %clang -target arm -march=armv6t2 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V6T2 %s
@@ -249,12 +249,14 @@
 // RUN: %clang -target arm-linux-gnueabi -mcpu=arm1136jf-s -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV6 %s
 // CHECK-CPUV6: "-cc1"{{.*}} "-triple" "armv6-{{.*}}
 
-// RUN: 

r253213 - [Myriad]: pass the 'std=' option to moviCompile

2015-11-16 Thread Douglas Katzman via cfe-commits
Author: dougk
Date: Mon Nov 16 09:38:40 2015
New Revision: 253213

URL: http://llvm.org/viewvc/llvm-project?rev=253213=rev
Log:
[Myriad]: pass the 'std=' option to moviCompile

Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/myriad-toolchain.c

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=253213=253212=253213=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Mon Nov 16 09:38:40 2015
@@ -9890,7 +9890,7 @@ void tools::SHAVE::Compiler::ConstructJo
   // 'f' flags, optimize flags, and warning options.
   // These are spelled the same way in clang and moviCompile.
   Args.AddAllArgs(CmdArgs, {options::OPT_I_Group, options::OPT_clang_i_Group,
-options::OPT_D, options::OPT_U,
+options::OPT_std_EQ, options::OPT_D, 
options::OPT_U,
 options::OPT_f_Group, options::OPT_f_clang_Group,
 options::OPT_g_Group, options::OPT_M_Group,
 options::OPT_O_Group, options::OPT_W_Group});

Modified: cfe/trunk/test/Driver/myriad-toolchain.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/myriad-toolchain.c?rev=253213=253212=253213=diff
==
--- cfe/trunk/test/Driver/myriad-toolchain.c (original)
+++ cfe/trunk/test/Driver/myriad-toolchain.c Mon Nov 16 09:38:40 2015
@@ -60,6 +60,10 @@
 // RUN:   | FileCheck %s -check-prefix=MDMF
 // MDMF: "-S" "-MD" "-MF" "dep.d" "-MT" "foo.o"
 
+// RUN: %clang -target shave-myriad -std=gnu++11 -S %s -o foo.o -### 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=STDEQ
+// STDEQ: "-mcpu=myriad2" "-S" "-std=gnu++11"
+
 // RUN: %clang -target sparc-myriad -### --driver-mode=g++ %s 2>&1 | FileCheck 
%s --check-prefix=STDLIBCXX
 // STDLIBCXX: "-lstdc++" "-lc" "-lgcc"
 


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


Re: [PATCH] D14686: Protect against overloaded comma in random_shuffle and improve tests

2015-11-16 Thread Dmitri Gribenko via cfe-commits
gribozavr added inline comments.


Comment at: 
test/std/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.pass.cpp:35
@@ -30,1 +34,3 @@
 }
+
+template 

mclow.lists wrote:
> This is not how I would rewrite this test.
> I would write a routine that took two "iterators", and called 
> `random_shuffle`, and then checked for the desired results.
> 
> Then call it with pointers. and RA iters, etc.
> for example:
> 
> template 
> void test(Iter first, Iter last, Iter resFirst, Iter resLast);
> 
> test(nullptr, nullptr, nullptr, nullptr);
> int source[] = {1, 2, 3, 4};
> int res  [] = {1, 2, 3, 4};
> const unsigned size = sizeof(source)/sizeof(source[0]);
> 
> test(source, source + size, res, res+size); 
> test(random_access_iterator(source)  );
> 
> 
I actually thought about this, and it is hard to rewrite it like that for two 
reasons.  First, `random_shuffle` mutates the elements, so one needs to restore 
the original sequence between calls to `test()` (otherwise it is not obvious 
that it was mutated).  Second, this overload of `random_shuffle` takes 
randomness from global state, so one can't just specify one expected result in 
the test.  That's why I first check for the initial shuffle exactly, and then 
only check that the output is a permutation of input.



Repository:
  rL LLVM

http://reviews.llvm.org/D14686



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


r253211 - [ARM,AArch64] Fix __rev16l and __rev16ll intrinsics

2015-11-16 Thread Oliver Stannard via cfe-commits
Author: olista01
Date: Mon Nov 16 08:58:50 2015
New Revision: 253211

URL: http://llvm.org/viewvc/llvm-project?rev=253211=rev
Log:
[ARM,AArch64] Fix __rev16l and __rev16ll intrinsics

These two intrinsics are defined in arm_acle.h.

__rev16l needs to rotate by 16 bits, bit it was actually rotating by 2 bits.
For AArch64, where long is 64 bits, this would still be wrong.

__rev16ll was incorrect, it reversed the bytes in each 32-bit word, rather than
each 16-bit halfword. The correct implementation is to apply __rev16 to the top
and bottom words of the 64-bit value.

For AArch32 targets, these get compiled down to the hardware rev16 instruction
at -O1 and above. For AArch64 targets, the 64-bit ones get compiled to two
32-bit rev16 instructions, because there is not currently a pattern for the
64-bit rev16 instruction.

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

Modified:
cfe/trunk/lib/Headers/arm_acle.h
cfe/trunk/test/CodeGen/arm_acle.c

Modified: cfe/trunk/lib/Headers/arm_acle.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/arm_acle.h?rev=253211=253210=253211=diff
==
--- cfe/trunk/lib/Headers/arm_acle.h (original)
+++ cfe/trunk/lib/Headers/arm_acle.h Mon Nov 16 08:58:50 2015
@@ -175,14 +175,18 @@ static __inline__ uint32_t __attribute__
   return __ror(__rev(t), 16);
 }
 
-static __inline__ unsigned long __attribute__((__always_inline__, __nodebug__))
-  __rev16l(unsigned long t) {
-return __rorl(__revl(t), sizeof(long) / 2);
-}
-
 static __inline__ uint64_t __attribute__((__always_inline__, __nodebug__))
   __rev16ll(uint64_t t) {
-  return __rorll(__revll(t), 32);
+  return (((uint64_t)__rev16(t >> 32)) << 32) | __rev16(t);
+}
+
+static __inline__ unsigned long __attribute__((__always_inline__, __nodebug__))
+  __rev16l(unsigned long t) {
+#if __SIZEOF_LONG__ == 4
+return __rev16(t);
+#else
+return __rev16ll(t);
+#endif
 }
 
 /* REVSH */

Modified: cfe/trunk/test/CodeGen/arm_acle.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/arm_acle.c?rev=253211=253210=253211=diff
==
--- cfe/trunk/test/CodeGen/arm_acle.c (original)
+++ cfe/trunk/test/CodeGen/arm_acle.c Mon Nov 16 08:58:50 2015
@@ -186,27 +186,53 @@ uint64_t test_revll(uint64_t t) {
 
 // ARM-LABEL: test_rev16
 // ARM: llvm.bswap
-// ARM: lshr
-// ARM: shl
+// ARM: lshr {{.*}}, 16
+// ARM: shl {{.*}}, 16
 // ARM: or
 uint32_t test_rev16(uint32_t t) {
   return __rev16(t);
 }
 
 // ARM-LABEL: test_rev16l
-// ARM: llvm.bswap
-// ARM: lshr
-// ARM: shl
-// ARM: or
+// AArch32: llvm.bswap
+// AArch32: lshr {{.*}}, 16
+// AArch32: shl {{.*}}, 16
+// AArch32: or
+// AArch64: [[T1:%.*]] = lshr i64 [[IN:%.*]], 32
+// AArch64: [[T2:%.*]] = trunc i64 [[T1]] to i32
+// AArch64: [[T3:%.*]] = tail call i32 @llvm.bswap.i32(i32 [[T2]])
+// AArch64: [[T4:%.*]] = lshr i32 [[T3]], 16
+// AArch64: [[T5:%.*]] = shl i32 [[T3]], 16
+// AArch64: [[T6:%.*]] = or i32 [[T5]], [[T4]]
+// AArch64: [[T7:%.*]] = zext i32 [[T6]] to i64
+// AArch64: [[T8:%.*]] = shl nuw i64 [[T7]], 32
+// AArch64: [[T9:%.*]] = trunc i64 [[IN]] to i32
+// AArch64: [[T10:%.*]] = tail call i32 @llvm.bswap.i32(i32 [[T9]])
+// AArch64: [[T11:%.*]] = lshr i32 [[T10]], 16
+// AArch64: [[T12:%.*]] = shl i32 [[T10]], 16
+// AArch64: [[T13:%.*]] = or i32 [[T12]], [[T11]]
+// AArch64: [[T14:%.*]] = zext i32 [[T13]] to i64
+// AArch64: [[T15:%.*]] = or i64 [[T8]], [[T14]]
 long test_rev16l(long t) {
   return __rev16l(t);
 }
 
 // ARM-LABEL: test_rev16ll
-// ARM: llvm.bswap
-// ARM: lshr
-// ARM: shl
-// ARM: or
+// ARM: [[T1:%.*]] = lshr i64 [[IN:%.*]], 32
+// ARM: [[T2:%.*]] = trunc i64 [[T1]] to i32
+// ARM: [[T3:%.*]] = tail call i32 @llvm.bswap.i32(i32 [[T2]])
+// ARM: [[T4:%.*]] = lshr i32 [[T3]], 16
+// ARM: [[T5:%.*]] = shl i32 [[T3]], 16
+// ARM: [[T6:%.*]] = or i32 [[T5]], [[T4]]
+// ARM: [[T7:%.*]] = zext i32 [[T6]] to i64
+// ARM: [[T8:%.*]] = shl nuw i64 [[T7]], 32
+// ARM: [[T9:%.*]] = trunc i64 [[IN]] to i32
+// ARM: [[T10:%.*]] = tail call i32 @llvm.bswap.i32(i32 [[T9]])
+// ARM: [[T11:%.*]] = lshr i32 [[T10]], 16
+// ARM: [[T12:%.*]] = shl i32 [[T10]], 16
+// ARM: [[T13:%.*]] = or i32 [[T12]], [[T11]]
+// ARM: [[T14:%.*]] = zext i32 [[T13]] to i64
+// ARM: [[T15:%.*]] = or i64 [[T8]], [[T14]]
 uint64_t test_rev16ll(uint64_t t) {
   return __rev16ll(t);
 }


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


Re: [PATCH] D14570: Handle ARMv6KZ naming

2015-11-16 Thread James Molloy via cfe-commits
Hi Renato,

Ideally, shouldn't the clang tests be checking that the LLVM target parsing
library is called with the correct arguments? then separate tests inside
LLVM check that the target parser works correctly?

As it stands, it seems like a very deliberate layering violation that could
really do with chopping up.

James

On Mon, 16 Nov 2015 at 12:19 Renato Golin via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> rengolin added a comment.
>
> In http://reviews.llvm.org/D14570#288132, @compnerd wrote:
>
> > Wow, this is tricky: the code change is in LLVM, and test change in
> clang :(.  However, this does seem to preserve the features.
>
>
> The problem is that Clang is the most important user of this library,
> which also has other users in LLVM. We just need to make sure that Clang is
> doing the right thing, and that the intentions are recorded on the right
> places. In this case, it's Clang. :)
>
>
> http://reviews.llvm.org/D14570
>
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D14609: [ARM, AArch64] Fix __rev16l and __rev16ll intrinsics

2015-11-16 Thread Renato Golin via cfe-commits
rengolin accepted this revision.
rengolin added a reviewer: rengolin.
rengolin added a comment.
This revision is now accepted and ready to land.

LGTM. The 64-bit rev pattern can be added later. Thanks!


Repository:
  rL LLVM

http://reviews.llvm.org/D14609



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


r253242 - When producing error messages for always_inline functions with the

2015-11-16 Thread Eric Christopher via cfe-commits
Author: echristo
Date: Mon Nov 16 12:29:59 2015
New Revision: 253242

URL: http://llvm.org/viewvc/llvm-project?rev=253242=rev
Log:
When producing error messages for always_inline functions with the
target attribute, don't include "negative" subtarget features in the
list of required features. Builtins are positive by default so don't
need this change, but we pull the default list of features from the
command line and so need to make sure that we only include features
that are turned on for code generation in our error.

Added:
cfe/trunk/test/CodeGen/target-features-no-error.c
Modified:
cfe/trunk/lib/CodeGen/CodeGenFunction.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=253242=253241=253242=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Mon Nov 16 12:29:59 2015
@@ -1917,8 +1917,11 @@ void CodeGenFunction::checkTargetFeature
 SmallVector ReqFeatures;
 llvm::StringMap CalleeFeatureMap;
 CGM.getFunctionFeatureMap(CalleeFeatureMap, TargetDecl);
-for (const auto  : CalleeFeatureMap)
-  ReqFeatures.push_back(F.getKey());
+for (const auto  : CalleeFeatureMap) {
+  // Only positive features are "required".
+  if (F.getValue())
+ReqFeatures.push_back(F.getKey());
+}
 if (!hasRequiredFeatures(ReqFeatures, CGM, FD, MissingFeature))
   CGM.getDiags().Report(E->getLocStart(), diag::err_function_needs_feature)
   << FD->getDeclName() << TargetDecl->getDeclName() << MissingFeature;

Added: cfe/trunk/test/CodeGen/target-features-no-error.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/target-features-no-error.c?rev=253242=auto
==
--- cfe/trunk/test/CodeGen/target-features-no-error.c (added)
+++ cfe/trunk/test/CodeGen/target-features-no-error.c Mon Nov 16 12:29:59 2015
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -emit-llvm -o - -target-feature 
-sse2
+
+// Verify that negative features don't cause additional requirements on the 
inline function.
+int __attribute__((target("sse"), always_inline)) foo(int a) {
+  return a + 4;
+}
+int bar() {
+  return foo(4); // expected-no-diagnostics
+}


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


r253255 - Correctly handle type mismatches in the __weak copy/move-initialization

2015-11-16 Thread John McCall via cfe-commits
Author: rjmccall
Date: Mon Nov 16 16:11:41 2015
New Revision: 253255

URL: http://llvm.org/viewvc/llvm-project?rev=253255=rev
Log:
Correctly handle type mismatches in the __weak copy/move-initialization
peephole I added in r250916.

rdar://23559789

Added:
cfe/trunk/test/CodeGenObjC/arc-weak.m
cfe/trunk/test/CodeGenObjCXX/arc-weak.mm
Modified:
cfe/trunk/lib/CodeGen/CGDecl.cpp

Modified: cfe/trunk/lib/CodeGen/CGDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=253255=253254=253255=diff
==
--- cfe/trunk/lib/CodeGen/CGDecl.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDecl.cpp Mon Nov 16 16:11:41 2015
@@ -600,12 +600,15 @@ static bool isAccessedBy(const ValueDecl
 
 static bool tryEmitARCCopyWeakInit(CodeGenFunction ,
const LValue , const Expr *init) {
+  bool needsCast = false;
+
   while (auto castExpr = dyn_cast(init->IgnoreParens())) {
 switch (castExpr->getCastKind()) {
 // Look through casts that don't require representation changes.
 case CK_NoOp:
 case CK_BitCast:
 case CK_BlockPointerToObjCPointerCast:
+  needsCast = true;
   break;
 
 // If we find an l-value to r-value cast from a __weak variable,
@@ -618,12 +621,19 @@ static bool tryEmitARCCopyWeakInit(CodeG
   // Emit the source l-value.
   LValue srcLV = CGF.EmitLValue(srcExpr);
 
+  // Handle a formal type change to avoid asserting.
+  auto srcAddr = srcLV.getAddress();
+  if (needsCast) {
+srcAddr = CGF.Builder.CreateElementBitCast(srcAddr,
+ destLV.getAddress().getElementType());
+  }
+
   // If it was an l-value, use objc_copyWeak.
   if (srcExpr->getValueKind() == VK_LValue) {
-CGF.EmitARCCopyWeak(destLV.getAddress(), srcLV.getAddress());
+CGF.EmitARCCopyWeak(destLV.getAddress(), srcAddr);
   } else {
 assert(srcExpr->getValueKind() == VK_XValue);
-CGF.EmitARCMoveWeak(destLV.getAddress(), srcLV.getAddress());
+CGF.EmitARCMoveWeak(destLV.getAddress(), srcAddr);
   }
   return true;
 }

Added: cfe/trunk/test/CodeGenObjC/arc-weak.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/arc-weak.m?rev=253255=auto
==
--- cfe/trunk/test/CodeGenObjC/arc-weak.m (added)
+++ cfe/trunk/test/CodeGenObjC/arc-weak.m Mon Nov 16 16:11:41 2015
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fblocks 
-fobjc-arc -fobjc-runtime-has-weak -o - %s | FileCheck %s
+
+__attribute((objc_root_class)) @interface A @end
+@interface B : A @end
+
+// rdar://problem/23559789
+//   Ensure that type differences don't cause an assert here.
+void test0(__weak B **src) {
+  __weak A *dest = *src;
+}
+// CHECK-LABEL: define void @test0
+// CHECK:   [[SRC:%.*]] = alloca [[B:%.*]]**, align 8
+// CHECK:   [[DEST:%.*]] = alloca [[A:%.*]]*, align 8
+// CHECK:   [[T0:%.*]] = load [[B]]**, [[B]]*** [[SRC]], align 8
+// CHECK-NEXT:  [[T1:%.*]] = bitcast [[B]]** [[T0]] to [[A]]**
+// CHECK-NEXT:  [[T2:%.*]] = bitcast [[A]]** [[DEST]] to i8**
+// CHECK-NEXT:  [[T3:%.*]] = bitcast [[A]]** [[T1]] to i8**
+// CHECK-NEXT:  call void @objc_copyWeak(i8** [[T2]], i8** [[T3]])
+// CHECK-NEXT:  [[T0:%.*]] = bitcast [[A]]** [[DEST]] to i8**
+// CHECK:   call void @objc_destroyWeak(i8** [[T0]])

Added: cfe/trunk/test/CodeGenObjCXX/arc-weak.mm
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjCXX/arc-weak.mm?rev=253255=auto
==
--- cfe/trunk/test/CodeGenObjCXX/arc-weak.mm (added)
+++ cfe/trunk/test/CodeGenObjCXX/arc-weak.mm Mon Nov 16 16:11:41 2015
@@ -0,0 +1,34 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fblocks 
-fobjc-arc -fobjc-runtime-has-weak -std=c++11 -o - %s | FileCheck %s
+
+__attribute((objc_root_class)) @interface A @end
+@interface B : A @end
+
+// rdar://problem/23559789
+//   Ensure that type differences don't cause an assert here.
+void test0(__weak B **src) {
+  __weak A *dest = *src;
+}
+// CHECK-LABEL: define void @_Z5test0PU6__weakP1B(
+// CHECK:   [[SRC:%.*]] = alloca [[B:%.*]]**, align 8
+// CHECK:   [[DEST:%.*]] = alloca [[A:%.*]]*, align 8
+// CHECK:   [[T0:%.*]] = load [[B]]**, [[B]]*** [[SRC]], align 8
+// CHECK-NEXT:  [[T1:%.*]] = bitcast [[B]]** [[T0]] to [[A]]**
+// CHECK-NEXT:  [[T2:%.*]] = bitcast [[A]]** [[DEST]] to i8**
+// CHECK-NEXT:  [[T3:%.*]] = bitcast [[A]]** [[T1]] to i8**
+// CHECK-NEXT:  call void @objc_copyWeak(i8** [[T2]], i8** [[T3]])
+// CHECK-NEXT:  [[T0:%.*]] = bitcast [[A]]** [[DEST]] to i8**
+// CHECK:   call void @objc_destroyWeak(i8** [[T0]])
+
+void test1(__weak B **src) {
+  __weak A *dest = static_cast<__weak B*&&>(*src);
+}
+// CHECK-LABEL: define void 

Re: [PATCH] D14506: Porting shouldVisitImplicitCode to DataRecursiveASTVisitor.

2015-11-16 Thread Richard Smith via cfe-commits
Rather than trying to maintain the horrible duplication between
DataRecursiveASTVisitor and RecursiveASTVisitor, can we just delete
DataRecursiveASTVisitor? RecursiveASTVisitor is data-recursive too these
days (and has a smarter implementation than DataRecursiveASTVisitor's from
what I can see), but doesn't yet apply data recursion in so many cases.

On Mon, Nov 16, 2015 at 1:07 PM, Argyrios Kyrtzidis 
wrote:

> LGTM.
>
> > On Nov 16, 2015, at 12:32 PM, Ben Craig 
> wrote:
> >
> > bcraig added a comment.
> >
> > Ping.  Note that the test is basically a copy / paste job, and the new
> code in DataRecursiveASTVisitor.h is a very direct translation from the
> 'regular' RecursiveASTVisitor.h.
> >
> >
> > http://reviews.llvm.org/D14506
> >
> >
> >
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r253012 - [modules] When a declaration has non-trivial visibility, check whether it's

2015-11-16 Thread Sean Silva via cfe-commits
On Mon, Nov 16, 2015 at 7:09 PM, Richard Smith 
wrote:

> On Mon, Nov 16, 2015 at 7:00 PM, Sean Silva  wrote:
>
>> On Sat, Nov 14, 2015 at 2:30 PM, Richard Smith 
>> wrote:
>>
>>> On Nov 13, 2015 7:23 PM, "Sean Silva"  wrote:
>>> >
>>> >
>>> >
>>> > On Thu, Nov 12, 2015 at 9:14 PM, Richard Smith via cfe-commits <
>>> cfe-commits@lists.llvm.org> wrote:
>>> >>
>>> >> Author: rsmith
>>> >> Date: Thu Nov 12 23:14:45 2015
>>> >> New Revision: 253012
>>> >>
>>> >> URL: http://llvm.org/viewvc/llvm-project?rev=253012=rev
>>> >> Log:
>>> >> [modules] When a declaration has non-trivial visibility, check
>>> whether it's
>>> >
>>> >
>>> > What is "non-trivial visibility"? Is this "visibility" something that
>>> exists in the present C++ language? (e.g. `using namespace std` etc.) or is
>>> this a different notion?
>>>
>>> This is the modules notion of visibility (whether the declaration has
>>> been imported or not). Here, non-trivial visibility means "not known to be
>>> unconditionally visible", and corresponds to the Hidden flag on the Decl
>>> being true.
>>>
>>
>> I just looked at the comment on the `Hidden` flag and it doesn't seem to
>> mention anything about being "trivial" or "non-trivial". Why say
>> "declaration has non-trivial visibility" instead of just "declaration is
>> hidden"? Do they mean different things?
>>
>
> Yes; the comment on that flag is out of date. Whether a declaration is
> visible is a function of several factors and isn't as simple as checking
> that flag. When performing template instantiation, names from unimported
> modules (and module-private names from imported modules) can be made
> visible if they were visible when the template was defined. When local
> submodule visibility is enabled, the visibility of a declaration is
> computed each time we reference it, because module visibility is not
> monotonically increasing.
>

Ah, that makes sense. Also that sounds scary complicated.

-- Sean Silva


>
> If the Hidden flag is false, the declararation is unconditionally visible.
> If the Hidden flag is true, the declaration might still be visible,
> depending on who's asking and from where.
>
>
>> -- Sean Silva
>>
>>
>>> > -- Sean Silva
>>> >
>>> >>
>>> >> actually hidden before we check its linkage. This avoids computing
>>> the linkage
>>> >> "too early" for an anonymous struct with a typedef name for linkage.
>>> >>
>>> >> Modified:
>>> >> cfe/trunk/include/clang/Sema/Lookup.h
>>> >> cfe/trunk/test/Modules/submodule-visibility.cpp
>>> >>
>>> >> Modified: cfe/trunk/include/clang/Sema/Lookup.h
>>> >> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Lookup.h?rev=253012=253011=253012=diff
>>> >>
>>> ==
>>> >> --- cfe/trunk/include/clang/Sema/Lookup.h (original)
>>> >> +++ cfe/trunk/include/clang/Sema/Lookup.h Thu Nov 12 23:14:45 2015
>>> >> @@ -303,8 +303,7 @@ public:
>>> >>  if (!D->isInIdentifierNamespace(IDNS))
>>> >>return nullptr;
>>> >>
>>> >> -if (!D->isHidden() || isHiddenDeclarationVisible(D) ||
>>> >> -isVisibleSlow(getSema(), D))
>>> >> +if (isVisible(getSema(), D) || isHiddenDeclarationVisible(D))
>>> >>return D;
>>> >>
>>> >>  return getAcceptableDeclSlow(D);
>>> >>
>>> >> Modified: cfe/trunk/test/Modules/submodule-visibility.cpp
>>> >> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/submodule-visibility.cpp?rev=253012=253011=253012=diff
>>> >>
>>> ==
>>> >> --- cfe/trunk/test/Modules/submodule-visibility.cpp (original)
>>> >> +++ cfe/trunk/test/Modules/submodule-visibility.cpp Thu Nov 12
>>> 23:14:45 2015
>>> >> @@ -28,3 +28,10 @@ int k = n + m; // OK, a and b are visibl
>>> >>  #ifndef B
>>> >>  #error B is not defined
>>> >>  #endif
>>> >> +
>>> >> +// Ensure we don't compute the linkage of this struct before we find
>>> it has a
>>> >> +// typedef name for linkage purposes.
>>> >> +typedef struct {
>>> >> +  int p;
>>> >> +  void (*f)(int p);
>>> >> +} name_for_linkage;
>>> >>
>>> >>
>>> >> ___
>>> >> cfe-commits mailing list
>>> >> cfe-commits@lists.llvm.org
>>> >> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>> >
>>> >
>>>
>>
>>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D14736: [analyzer] DeadStoresChecker: Treat locals captured by reference in C++ lambdas as escaped.

2015-11-16 Thread Devin Coughlin via cfe-commits
dcoughlin added a comment.

This is PR 22834. https://llvm.org/bugs/show_bug.cgi?id=22834.


http://reviews.llvm.org/D14736



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


Re: r253012 - [modules] When a declaration has non-trivial visibility, check whether it's

2015-11-16 Thread Sean Silva via cfe-commits
On Sat, Nov 14, 2015 at 2:30 PM, Richard Smith 
wrote:

> On Nov 13, 2015 7:23 PM, "Sean Silva"  wrote:
> >
> >
> >
> > On Thu, Nov 12, 2015 at 9:14 PM, Richard Smith via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
> >>
> >> Author: rsmith
> >> Date: Thu Nov 12 23:14:45 2015
> >> New Revision: 253012
> >>
> >> URL: http://llvm.org/viewvc/llvm-project?rev=253012=rev
> >> Log:
> >> [modules] When a declaration has non-trivial visibility, check whether
> it's
> >
> >
> > What is "non-trivial visibility"? Is this "visibility" something that
> exists in the present C++ language? (e.g. `using namespace std` etc.) or is
> this a different notion?
>
> This is the modules notion of visibility (whether the declaration has been
> imported or not). Here, non-trivial visibility means "not known to be
> unconditionally visible", and corresponds to the Hidden flag on the Decl
> being true.
>

I just looked at the comment on the `Hidden` flag and it doesn't seem to
mention anything about being "trivial" or "non-trivial". Why say
"declaration has non-trivial visibility" instead of just "declaration is
hidden"? Do they mean different things?

-- Sean Silva


> > -- Sean Silva
> >
> >>
> >> actually hidden before we check its linkage. This avoids computing the
> linkage
> >> "too early" for an anonymous struct with a typedef name for linkage.
> >>
> >> Modified:
> >> cfe/trunk/include/clang/Sema/Lookup.h
> >> cfe/trunk/test/Modules/submodule-visibility.cpp
> >>
> >> Modified: cfe/trunk/include/clang/Sema/Lookup.h
> >> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Lookup.h?rev=253012=253011=253012=diff
> >>
> ==
> >> --- cfe/trunk/include/clang/Sema/Lookup.h (original)
> >> +++ cfe/trunk/include/clang/Sema/Lookup.h Thu Nov 12 23:14:45 2015
> >> @@ -303,8 +303,7 @@ public:
> >>  if (!D->isInIdentifierNamespace(IDNS))
> >>return nullptr;
> >>
> >> -if (!D->isHidden() || isHiddenDeclarationVisible(D) ||
> >> -isVisibleSlow(getSema(), D))
> >> +if (isVisible(getSema(), D) || isHiddenDeclarationVisible(D))
> >>return D;
> >>
> >>  return getAcceptableDeclSlow(D);
> >>
> >> Modified: cfe/trunk/test/Modules/submodule-visibility.cpp
> >> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/submodule-visibility.cpp?rev=253012=253011=253012=diff
> >>
> ==
> >> --- cfe/trunk/test/Modules/submodule-visibility.cpp (original)
> >> +++ cfe/trunk/test/Modules/submodule-visibility.cpp Thu Nov 12 23:14:45
> 2015
> >> @@ -28,3 +28,10 @@ int k = n + m; // OK, a and b are visibl
> >>  #ifndef B
> >>  #error B is not defined
> >>  #endif
> >> +
> >> +// Ensure we don't compute the linkage of this struct before we find
> it has a
> >> +// typedef name for linkage purposes.
> >> +typedef struct {
> >> +  int p;
> >> +  void (*f)(int p);
> >> +} name_for_linkage;
> >>
> >>
> >> ___
> >> 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


[libcxx] r253293 - Creating release candidate rc1 from release_371 branch

2015-11-16 Thread Tom Stellard via cfe-commits
Author: tstellar
Date: Mon Nov 16 21:25:27 2015
New Revision: 253293

URL: http://llvm.org/viewvc/llvm-project?rev=253293=rev
Log:
Creating release candidate rc1 from release_371 branch

Added:
libcxx/tags/RELEASE_371/rc1/   (props changed)
  - copied from r253292, libcxx/branches/release_37/

Propchange: libcxx/tags/RELEASE_371/rc1/
--
--- svn:mergeinfo (added)
+++ svn:mergeinfo Mon Nov 16 21:25:27 2015
@@ -0,0 +1,2 @@
+/libcxx/branches/apple:136569-137939
+/libcxx/trunk:242377,242421,243530,243641,244003,244462


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


[libunwind] r253307 - Creating release candidate rc1 from release_371 branch

2015-11-16 Thread Tom Stellard via cfe-commits
Author: tstellar
Date: Mon Nov 16 21:25:56 2015
New Revision: 253307

URL: http://llvm.org/viewvc/llvm-project?rev=253307=rev
Log:
Creating release candidate rc1 from release_371 branch

Added:
libunwind/tags/RELEASE_371/rc1/   (props changed)
  - copied from r253306, libunwind/branches/release_37/

Propchange: libunwind/tags/RELEASE_371/rc1/
--
svn:mergeinfo = /libunwind/trunk:242642,243073,244005,244237


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


Lit test C++11 Compatibility Patch #4

2015-11-16 Thread Li, Charles via cfe-commits
Hi Everyone,

Here is the forth Lit tests C++11 compatibility patch.
This patch mainly added new diagnostics expected for C++11.
There are 34 tests in total. They fall into 3 categories.

  [2 tests]  New Warnings regarding storage class specifier "register"/"auto" 
being deprecated/not-allowed.
  [18 Tests] New Note "candidate constructor (the implicit move constructor) 
not viable" accompanying existing Error "no matching constructor"
  [14 Tests] New Note "candidate function (the implicit move assignment 
operator) not viable" accompanying existing Error "no viable overloaded '='"


There is a walkthrough of each test
CXX/basic/basic.lookup/basic.lookup.argdep/p4.cpp
  Added "move constructor" message

CXX/basic/basic.lookup/basic.lookup.qual/namespace.qual/p2.cpp
  Added "move constructor" message
  Note: Also restricted expected Warning "inline namespaces are a C++11 
feature" to C++98/03 and earlier

CXX/basic/basic.scope/basic.scope.hiding/p2.cpp
  Added "move constructor" message

CXX/dcl.dcl/basic.namespace/namespace.udecl/p1.cpp
  Added "move constructor" message

CXX/dcl.dcl/dcl.spec/dcl.stc/p2.cpp
  Added "auto" and "register" message.
  The 2 messages are:
 'auto' storage class specifier is not permitted in C++11, and will not be 
supported in future releases
 'register' storage class specifier is deprecated
  Note: The original run line has option "-Wno-c++0x-compat" This is the 
default behavior in C++98/03,
"-Wno-c++0x-compat" has no effect in C++11.
To avoid confusion, I kept the original run line as is and added 3 more 
run lines
which are default, C++98 and C++11

CXX/dcl.decl/dcl.init/dcl.init.ref/p5-var.cpp
  Added "move constructor" message

CXX/temp/temp.decls/temp.class/temp.static/p1-inst.cpp
  Added "move constructor" message

CXX/temp/temp.decls/temp.class/temp.static/p1.cpp
  Added "move constructor" message

CXX/temp/temp.param/p3.cpp
  Added "move constructor" message

CXX/temp/temp.spec/temp.explicit/p1.cpp
  Added "move constructor" message

OpenMP/for_reduction_messages.cpp
  Added "move assignment operator" message

OpenMP/for_simd_reduction_messages.cpp
  Added "move assignment operator" message

OpenMP/parallel_for_reduction_messages.cpp
  Added "move assignment operator" message

OpenMP/parallel_for_simd_reduction_messages.cpp
  Added "move assignment operator" message

OpenMP/parallel_reduction_messages.cpp
  Added "move assignment operator" message

OpenMP/parallel_sections_reduction_messages.cpp
  Added "move assignment operator" message

OpenMP/sections_reduction_messages.cpp
  Added "move assignment operator" message

OpenMP/simd_reduction_messages.cpp
  Added "move assignment operator" message

OpenMP/teams_reduction_messages.cpp
  Added "move assignment operator" message

SemaCXX/constructor-initializer.cpp
  Added "move constructor" message

SemaCXX/converting-constructor.cpp
  Added "move constructor" message

SemaCXX/crashes.cpp
  Added "move constructor" message

SemaCXX/default1.cpp
  Added "move constructor" message

SemaCXX/direct-initializer.cpp
  Added "move constructor" message

SemaCXX/expressions.cpp
 Added "'register' storage class specifier is deprecated" message

SemaCXX/namespace.cpp
  Added "move assignment operator" message

SemaCXX/overload-call-copycon.cpp
  Added "move constructor" message

SemaCXX/overloaded-builtin-operators.cpp
  Added "move assignment operator" message

SemaCXX/vector.cpp
  Added "move assignment operator" message

SemaTemplate/class-template-ctor-initializer.cpp
  Added "move assignment operator" message

SemaTemplate/constructor-template.cpp
  Added "move constructor" message

SemaTemplate/default-expr-arguments.cpp
  Added "move constructor" message

SemaTemplate/fun-template-def.cpp
  Added "move constructor" message

SemaTemplate/qualified-names-diag.cpp
  Added "move assignment operator" message


All feed backs are welcome.

Thank you.
Charles Li



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


[PATCH] D14737: Convert some ObjC msgSends to runtime calls

2015-11-16 Thread Pete Cooper via cfe-commits
pete created this revision.
pete added a reviewer: rjmccall.
pete added a subscriber: cfe-commits.

It is faster to directly call the ObjC runtime for methods such as 
retain/release instead of sending a message to those functions.

This patch adds support for converting messages to 
retain/release/alloc/autorelease to their equivalent runtime calls.

Tests included for the positive case of applying this transformation, negative 
tests that we ensure we only convert "alloc" to objc_alloc, not "alloc2", and 
also a driver test to ensure we enable this only for supported runtime versions.

http://reviews.llvm.org/D14737

Files:
  include/clang/Basic/LangOptions.def
  include/clang/Basic/ObjCRuntime.h
  include/clang/Driver/Options.td
  lib/CodeGen/CGObjC.cpp
  lib/CodeGen/CGObjCMac.cpp
  lib/CodeGen/CodeGenFunction.h
  lib/CodeGen/CodeGenModule.h
  lib/Driver/Tools.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/CodeGenObjC/convert-messages-to-runtime-calls.m
  test/Driver/objc-convert-messages-to-runtime-calls.m

Index: test/Driver/objc-convert-messages-to-runtime-calls.m
===
--- /dev/null
+++ test/Driver/objc-convert-messages-to-runtime-calls.m
@@ -0,0 +1,17 @@
+// RUN: %clang %s -### -o %t.o 2>&1 -fobjc-convert-messages-to-runtime-calls -fsyntax-only -fno-objc-convert-messages-to-runtime-calls -target x86_64-apple-macosx10.10.0 | FileCheck  %s --check-prefix=DISABLE
+// RUN: %clang %s -### -o %t.o 2>&1 -fobjc-convert-messages-to-runtime-calls -fsyntax-only -target x86_64-apple-macosx10.10.0 | FileCheck  %s --check-prefix=ENABLE
+// RUN: %clang %s -### -o %t.o 2>&1 -fsyntax-only -target x86_64-apple-macosx10.10.0 | FileCheck  %s --check-prefix=SUPPORTED_MACOS
+// RUN: %clang %s -### -o %t.o 2>&1 -fsyntax-only -target x86_64-apple-macosx10.9.0 | FileCheck  %s --check-prefix=UNSUPPORTED_MACOS
+// RUN: %clang %s -### -o %t.o 2>&1 -fsyntax-only -target armv7-apple-ios8.0 | FileCheck  %s --check-prefix=SUPPORTED_IOS
+// RUN: %clang %s -### -o %t.o 2>&1 -fsyntax-only -target armv7-apple-ios7.0 | FileCheck  %s --check-prefix=UNSUPPORTED_IOS
+
+// Check that we pass fobjc-convert-messages-to-runtime-calls only when supported, and not explicitly disabled.
+
+// DISABLE-NOT: "-fobjc-convert-messages-to-runtime-calls"
+// ENABLE: "-fobjc-convert-messages-to-runtime-calls"
+// SUPPORTED_MACOS: "-fobjc-convert-messages-to-runtime-calls"
+// UNSUPPORTED_MACOS-NOT: "-fobjc-convert-messages-to-runtime-calls"
+// SUPPORTED_IOS: "-fobjc-convert-messages-to-runtime-calls"
+// UNSUPPORTED_IOS-NOT: "-fobjc-convert-messages-to-runtime-calls"
+
+
Index: test/CodeGenObjC/convert-messages-to-runtime-calls.m
===
--- /dev/null
+++ test/CodeGenObjC/convert-messages-to-runtime-calls.m
@@ -0,0 +1,38 @@
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.10.0 -emit-llvm -o - %s | FileCheck %s --check-prefix=MSGS
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.10.0 -emit-llvm -o - %s -fobjc-convert-messages-to-runtime-calls | FileCheck %s --check-prefix=CALLS
+
+@interface NSObject
++ (id)alloc;
++ (id)alloc2;
+- (id)init;
+- (id)retain;
+- (void)release;
+- (id)autorelease;
+@end
+
+@interface NSString : NSObject
+@end
+
+// CHECK-LABEL: define {{.*}}void @test1
+void test1(id x) {
+  // MSGS: {{call.*@objc_msgSend}}
+  // MSGS: {{call.*@objc_msgSend}}
+  // MSGS: {{call.*@objc_msgSend}}
+  // MSGS: {{call.*@objc_msgSend}}
+  // CALLS: {{call.*@objc_alloc}}
+  // CALLS: {{call.*@objc_retain}}
+  // CALLS: {{call.*@objc_release}}
+  // CALLS: {{call.*@objc_autorelease}}
+  [NSObject alloc];
+  [x retain];
+  [x release];
+  [x autorelease];
+}
+
+// CHECK-LABEL: define {{.*}}void @test2
+void test2() {
+  // MSGS: {{call.*@objc_msgSend}}
+  // CALLS: {{call.*@objc_msgSend}}
+  // Make sure alloc has the correct name and number of types.
+  [NSObject alloc2];
+}
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -1519,6 +1519,9 @@
 if (Args.hasArg(OPT_fobjc_subscripting_legacy_runtime))
   Opts.ObjCSubscriptingLegacyRuntime =
 (Opts.ObjCRuntime.getKind() == ObjCRuntime::FragileMacOSX);
+
+if (Args.hasArg(OPT_fobjc_convert_messages_to_runtime_calls))
+  Opts.ObjCConvertMessagesToRuntimeCalls = 1;
   }
 
   if (Args.hasArg(OPT_fgnu89_inline)) {
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -4842,6 +4842,15 @@
 
   }
 
+  // Allow the user to control whether messages can be converted to runtime
+  // functions.
+  if (types::isObjC(InputType) &&
+  Args.hasFlag(options::OPT_fobjc_convert_messages_to_runtime_calls,
+   options::OPT_fno_objc_convert_messages_to_runtime_calls,
+   true) &&
+  

[clang-tools-extra] r253310 - modularize: add install rule

2015-11-16 Thread Saleem Abdulrasool via cfe-commits
Author: compnerd
Date: Mon Nov 16 23:09:18 2015
New Revision: 253310

URL: http://llvm.org/viewvc/llvm-project?rev=253310=rev
Log:
modularize: add install rule

This allows modularize to be installed.  Previously, no install rule would be
created for it.

Modified:
clang-tools-extra/trunk/modularize/CMakeLists.txt

Modified: clang-tools-extra/trunk/modularize/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/modularize/CMakeLists.txt?rev=253310=253309=253310=diff
==
--- clang-tools-extra/trunk/modularize/CMakeLists.txt (original)
+++ clang-tools-extra/trunk/modularize/CMakeLists.txt Mon Nov 16 23:09:18 2015
@@ -19,3 +19,7 @@ target_link_libraries(modularize
   clangLex
   clangTooling
   )
+
+install(TARGETS modularize
+RUNTIME DESTINATION bin
+COMPONENT clang-extras)


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


r253316 - [Sema] Remove unnecessary typecast of bool to int when passing arguments to diagnostics. NFC

2015-11-16 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Mon Nov 16 23:40:12 2015
New Revision: 253316

URL: http://llvm.org/viewvc/llvm-project?rev=253316=rev
Log:
[Sema] Remove unnecessary typecast of bool to int when passing arguments to 
diagnostics. NFC

Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=253316=253315=253316=diff
==
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Mon Nov 16 23:40:12 2015
@@ -4160,7 +4160,7 @@ Decl *Sema::BuildAnonymousStructOrUnion(
 assert(FD->getAccess() != AS_none);
 if (FD->getAccess() != AS_public) {
   Diag(FD->getLocation(), diag::err_anonymous_record_nonpublic_member)
-<< (int)Record->isUnion() << (int)(FD->getAccess() == 
AS_protected);
+<< Record->isUnion() << (FD->getAccess() == AS_protected);
   Invalid = true;
 }
 
@@ -4184,11 +4184,11 @@ Decl *Sema::BuildAnonymousStructOrUnion(
   // Visual C++ allows type definition in anonymous struct or union.
   if (getLangOpts().MicrosoftExt)
 Diag(MemRecord->getLocation(), 
diag::ext_anonymous_record_with_type)
-  << (int)Record->isUnion();
+  << Record->isUnion();
   else {
 // This is a nested type declaration.
 Diag(MemRecord->getLocation(), 
diag::err_anonymous_record_with_type)
-  << (int)Record->isUnion();
+  << Record->isUnion();
 Invalid = true;
   }
 } else {
@@ -4197,7 +4197,7 @@ Decl *Sema::BuildAnonymousStructOrUnion(
   // not part of standard C++.
   Diag(MemRecord->getLocation(),
diag::ext_anonymous_record_with_anonymous_type)
-<< (int)Record->isUnion();
+<< Record->isUnion();
 }
   } else if (isa(Mem)) {
 // Any access specifier is fine.
@@ -4218,10 +4218,9 @@ Decl *Sema::BuildAnonymousStructOrUnion(
 if (getLangOpts().MicrosoftExt &&
 DK == diag::err_anonymous_record_with_type)
   Diag(Mem->getLocation(), diag::ext_anonymous_record_with_type)
-<< (int)Record->isUnion();
+<< Record->isUnion();
 else {
-  Diag(Mem->getLocation(), DK)
-  << (int)Record->isUnion();
+  Diag(Mem->getLocation(), DK) << Record->isUnion();
   Invalid = true;
 }
   }
@@ -4238,7 +4237,7 @@ Decl *Sema::BuildAnonymousStructOrUnion(
 
   if (!Record->isUnion() && !Owner->isRecord()) {
 Diag(Record->getLocation(), diag::err_anonymous_struct_not_member)
-  << (int)getLangOpts().CPlusPlus;
+  << getLangOpts().CPlusPlus;
 Invalid = true;
   }
 
@@ -13158,7 +13157,7 @@ bool Sema::CheckNontrivialField(FieldDec
 Diag(FD->getLocation(), getLangOpts().CPlusPlus11 ?
diag::warn_cxx98_compat_nontrivial_union_or_anon_struct_member :
diag::err_illegal_union_or_anon_struct_member)
-  << (int)FD->getParent()->isUnion() << FD->getDeclName() << member;
+  << FD->getParent()->isUnion() << FD->getDeclName() << member;
 DiagnoseNontrivial(RDecl, member);
 return !getLangOpts().CPlusPlus11;
   }


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


r253314 - [Sema] Minor formatting fixes. NFC

2015-11-16 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Mon Nov 16 23:40:05 2015
New Revision: 253314

URL: http://llvm.org/viewvc/llvm-project?rev=253314=rev
Log:
[Sema] Minor formatting fixes. NFC

Modified:
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/lib/Sema/SemaDeclObjC.cpp
cfe/trunk/lib/Sema/SemaStmt.cpp
cfe/trunk/lib/Sema/SemaType.cpp

Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=253314=253313=253314=diff
==
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Mon Nov 16 23:40:05 2015
@@ -1628,7 +1628,7 @@ static void handleAnalyzerNoReturnAttr(S
 !VD->getType()->isFunctionPointerType())) {
   S.Diag(Attr.getLoc(),
  Attr.isCXX11Attribute() ? diag::err_attribute_wrong_decl_type
- : diag::warn_attribute_wrong_decl_type)
+ : diag::warn_attribute_wrong_decl_type)
 << Attr.getName() << ExpectedFunctionMethodOrBlock;
   return;
 }

Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=253314=253313=253314=diff
==
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Mon Nov 16 23:40:05 2015
@@ -2264,7 +2264,7 @@ static bool CheckMethodOverrideReturn(Se
 
   DiagID = 
 IsOverridingMode ? diag::warn_non_covariant_overriding_ret_types 
-  : diag::warn_non_covariant_ret_types;
+ : diag::warn_non_covariant_ret_types;
 }
   }
 
@@ -2348,7 +2348,7 @@ static bool CheckMethodOverrideParam(Sem
 
   DiagID = 
   IsOverridingMode ? diag::warn_non_contravariant_overriding_param_types 
-   :  diag::warn_non_contravariant_param_types;
+   : diag::warn_non_contravariant_param_types;
 }
   }
 
@@ -2357,7 +2357,7 @@ static bool CheckMethodOverrideParam(Sem
 << MethodImpl->getDeclName() << IfaceTy << ImplTy;
   S.Diag(IfaceVar->getLocation(), 
  (IsOverridingMode ? diag::note_previous_declaration 
-: diag::note_previous_definition))
+   : diag::note_previous_definition))
 << getTypeRange(IfaceVar->getTypeSourceInfo());
   return false;
 }

Modified: cfe/trunk/lib/Sema/SemaStmt.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmt.cpp?rev=253314=253313=253314=diff
==
--- cfe/trunk/lib/Sema/SemaStmt.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmt.cpp Mon Nov 16 23:40:05 2015
@@ -3216,7 +3216,7 @@ StmtResult Sema::BuildReturnStmt(SourceL
 }
 // return (some void expression); is legal in C++.
 else if (D != diag::ext_return_has_void_expr ||
-!getLangOpts().CPlusPlus) {
+ !getLangOpts().CPlusPlus) {
   NamedDecl *CurDecl = getCurFunctionOrMethodDecl();
 
   int FunctionKind = 0;

Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=253314=253313=253314=diff
==
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Mon Nov 16 23:40:05 2015
@@ -2146,7 +2146,7 @@ QualType Sema::BuildArrayType(QualType T
 } else if (ASM != ArrayType::Normal || Quals != 0)
   Diag(Loc,
getLangOpts().CPlusPlus? diag::err_c99_array_usage_cxx
- : diag::ext_c99_array_usage) << ASM;
+  : diag::ext_c99_array_usage) << ASM;
   }
 
   if (T->isVariableArrayType()) {


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


Re: [PATCH] D13336: [MSVC] 'property' with an empty array in array subscript expression.

2015-11-16 Thread Alexey Bataev via cfe-commits
ABataev updated this revision to Diff 40253.
ABataev marked 3 inline comments as done.
ABataev added a comment.

Update after review


http://reviews.llvm.org/D13336

Files:
  include/clang/AST/DataRecursiveASTVisitor.h
  include/clang/AST/ExprCXX.h
  include/clang/AST/RecursiveASTVisitor.h
  include/clang/Basic/StmtNodes.td
  include/clang/Serialization/ASTBitCodes.h
  lib/AST/Expr.cpp
  lib/AST/ExprClassification.cpp
  lib/AST/ExprConstant.cpp
  lib/AST/ItaniumMangle.cpp
  lib/AST/StmtPrinter.cpp
  lib/AST/StmtProfile.cpp
  lib/Sema/SemaExceptionSpec.cpp
  lib/Sema/SemaExpr.cpp
  lib/Sema/SemaPseudoObject.cpp
  lib/Sema/TreeTransform.h
  lib/Serialization/ASTReaderStmt.cpp
  lib/Serialization/ASTWriterStmt.cpp
  lib/StaticAnalyzer/Core/ExprEngine.cpp
  test/CodeGenCXX/ms-property.cpp
  test/SemaCXX/ms-property-error.cpp
  test/SemaCXX/ms-property.cpp
  tools/libclang/CXCursor.cpp

Index: lib/Serialization/ASTWriterStmt.cpp
===
--- lib/Serialization/ASTWriterStmt.cpp
+++ lib/Serialization/ASTWriterStmt.cpp
@@ -1668,6 +1668,14 @@
   Code = serialization::EXPR_CXX_PROPERTY_REF_EXPR;
 }
 
+void ASTStmtWriter::VisitMSPropertySubscriptExpr(MSPropertySubscriptExpr *E) {
+  VisitExpr(E);
+  Writer.AddStmt(E->getBase());
+  Writer.AddStmt(E->getIdx());
+  Writer.AddSourceLocation(E->getRBracketLoc(), Record);
+  Code = serialization::EXPR_CXX_PROPERTY_SUBSCRIPT_EXPR;
+}
+
 void ASTStmtWriter::VisitCXXUuidofExpr(CXXUuidofExpr *E) {
   VisitExpr(E);
   Writer.AddSourceRange(E->getSourceRange(), Record);
Index: lib/Serialization/ASTReaderStmt.cpp
===
--- lib/Serialization/ASTReaderStmt.cpp
+++ lib/Serialization/ASTReaderStmt.cpp
@@ -1641,6 +1641,13 @@
   E->TheDecl = ReadDeclAs(Record, Idx);
 }
 
+void ASTStmtReader::VisitMSPropertySubscriptExpr(MSPropertySubscriptExpr *E) {
+  VisitExpr(E);
+  E->setBase(Reader.ReadSubExpr());
+  E->setIdx(Reader.ReadSubExpr());
+  E->setRBracketLoc(ReadSourceLocation(Record, Idx));
+}
+
 void ASTStmtReader::VisitCXXUuidofExpr(CXXUuidofExpr *E) {
   VisitExpr(E);
   E->setSourceRange(ReadSourceRange(Record, Idx));
@@ -3037,6 +3044,9 @@
 case EXPR_CXX_PROPERTY_REF_EXPR:
   S = new (Context) MSPropertyRefExpr(Empty);
   break;
+case EXPR_CXX_PROPERTY_SUBSCRIPT_EXPR:
+  S = new (Context) MSPropertySubscriptExpr(Empty);
+  break;
 case EXPR_CXX_UUIDOF_TYPE:
   S = new (Context) CXXUuidofExpr(Empty, false);
   break;
Index: lib/StaticAnalyzer/Core/ExprEngine.cpp
===
--- lib/StaticAnalyzer/Core/ExprEngine.cpp
+++ lib/StaticAnalyzer/Core/ExprEngine.cpp
@@ -754,6 +754,7 @@
 case Stmt::CXXUuidofExprClass:
 case Stmt::CXXFoldExprClass:
 case Stmt::MSPropertyRefExprClass:
+case Stmt::MSPropertySubscriptExprClass:
 case Stmt::CXXUnresolvedConstructExprClass:
 case Stmt::DependentScopeDeclRefExprClass:
 case Stmt::ArrayTypeTraitExprClass:
Index: lib/AST/Expr.cpp
===
--- lib/AST/Expr.cpp
+++ lib/AST/Expr.cpp
@@ -2998,6 +2998,7 @@
 return true;
 
   case MSPropertyRefExprClass:
+  case MSPropertySubscriptExprClass:
   case CompoundAssignOperatorClass:
   case VAArgExprClass:
   case AtomicExprClass:
Index: lib/AST/StmtProfile.cpp
===
--- lib/AST/StmtProfile.cpp
+++ lib/AST/StmtProfile.cpp
@@ -1123,6 +1123,11 @@
   VisitDecl(S->getPropertyDecl());
 }
 
+void StmtProfiler::VisitMSPropertySubscriptExpr(
+const MSPropertySubscriptExpr *S) {
+  VisitExpr(S);
+}
+
 void StmtProfiler::VisitCXXThisExpr(const CXXThisExpr *S) {
   VisitExpr(S);
   ID.AddBoolean(S->isImplicit());
Index: lib/AST/StmtPrinter.cpp
===
--- lib/AST/StmtPrinter.cpp
+++ lib/AST/StmtPrinter.cpp
@@ -1715,6 +1715,13 @@
   OS << Node->getPropertyDecl()->getDeclName();
 }
 
+void StmtPrinter::VisitMSPropertySubscriptExpr(MSPropertySubscriptExpr *Node) {
+  PrintExpr(Node->getBase());
+  OS << "[";
+  PrintExpr(Node->getIdx());
+  OS << "]";
+}
+
 void StmtPrinter::VisitUserDefinedLiteral(UserDefinedLiteral *Node) {
   switch (Node->getLiteralOperatorKind()) {
   case UserDefinedLiteral::LOK_Raw:
Index: lib/AST/ItaniumMangle.cpp
===
--- lib/AST/ItaniumMangle.cpp
+++ lib/AST/ItaniumMangle.cpp
@@ -2809,6 +2809,7 @@
   case Expr::ParenListExprClass:
   case Expr::LambdaExprClass:
   case Expr::MSPropertyRefExprClass:
+  case Expr::MSPropertySubscriptExprClass:
   case Expr::TypoExprClass:  // This should no longer exist in the AST by now.
   case Expr::OMPArraySectionExprClass:
 llvm_unreachable("unexpected statement kind");
Index: lib/AST/ExprConstant.cpp
===

r253190 - [CGDebugInfo] Set the size and align for reference types

2015-11-16 Thread Keno Fischer via cfe-commits
Author: kfischer
Date: Mon Nov 16 03:04:13 2015
New Revision: 253190

URL: http://llvm.org/viewvc/llvm-project?rev=253190=rev
Log:
[CGDebugInfo] Set the size and align for reference types

In r253186, I changed the DIBuilder API to now take size and align
for reference types as well. This was done in preparation for upcoming
changes to the Verifier that will validate that sizes match between
DI types and IR values that are declared as having those types.
This updates clang to actually pass the information through.

Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/test/CodeGenCXX/debug-info-rvalue-ref.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=253190=253189=253190=diff
==
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon Nov 16 03:04:13 2015
@@ -712,10 +712,6 @@ llvm::DIType *CGDebugInfo::CreatePointer
  const Type *Ty,
  QualType PointeeTy,
  llvm::DIFile *Unit) {
-  if (Tag == llvm::dwarf::DW_TAG_reference_type ||
-  Tag == llvm::dwarf::DW_TAG_rvalue_reference_type)
-return DBuilder.createReferenceType(Tag, getOrCreateType(PointeeTy, Unit));
-
   // Bit size, align and offset of the type.
   // Size is always the size of a pointer. We can't use getTypeSize here
   // because that does not return the correct value for references.
@@ -723,8 +719,13 @@ llvm::DIType *CGDebugInfo::CreatePointer
   uint64_t Size = CGM.getTarget().getPointerWidth(AS);
   uint64_t Align = CGM.getContext().getTypeAlign(Ty);
 
-  return DBuilder.createPointerType(getOrCreateType(PointeeTy, Unit), Size,
-Align);
+  if (Tag == llvm::dwarf::DW_TAG_reference_type ||
+  Tag == llvm::dwarf::DW_TAG_rvalue_reference_type)
+return DBuilder.createReferenceType(Tag, getOrCreateType(PointeeTy, Unit),
+Size, Align);
+  else
+return DBuilder.createPointerType(getOrCreateType(PointeeTy, Unit), Size,
+  Align);
 }
 
 llvm::DIType *CGDebugInfo::getOrCreateStructPtrType(StringRef Name,

Modified: cfe/trunk/test/CodeGenCXX/debug-info-rvalue-ref.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-rvalue-ref.cpp?rev=253190=253189=253190=diff
==
--- cfe/trunk/test/CodeGenCXX/debug-info-rvalue-ref.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-rvalue-ref.cpp Mon Nov 16 03:04:13 2015
@@ -8,5 +8,5 @@ void foo (int &)
   printf("%d\n", i);
 }
 
-// CHECK: !DIDerivedType(tag: DW_TAG_rvalue_reference_type, baseType: 
![[INT:[0-9]+]])
+// CHECK: !DIDerivedType(tag: DW_TAG_rvalue_reference_type, baseType: 
![[INT:[0-9]+]], size: 64, align: 64)
 // CHECK: ![[INT]] = !DIBasicType(name: "int"


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


r253191 - Update for the gnu flavor being renamed to old-gnu.

2015-11-16 Thread Rafael Espindola via cfe-commits
Author: rafael
Date: Mon Nov 16 03:12:12 2015
New Revision: 253191

URL: http://llvm.org/viewvc/llvm-project?rev=253191=rev
Log:
Update for the gnu flavor being renamed to old-gnu.

Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/amdgpu-toolchain.c
cfe/trunk/test/Driver/mingw-useld.c
cfe/trunk/test/Driver/mips-mti-linux.c

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=253191=253190=253191=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Mon Nov 16 03:12:12 2015
@@ -6224,7 +6224,7 @@ void amdgpu::Linker::ConstructJob(Compil
   std::string Linker = getToolChain().GetProgramPath(getShortName());
   ArgStringList CmdArgs;
   CmdArgs.push_back("-flavor");
-  CmdArgs.push_back("gnu");
+  CmdArgs.push_back("old-gnu");
   CmdArgs.push_back("-target");
   CmdArgs.push_back(Args.MakeArgString(getToolChain().getTripleString()));
   AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs);
@@ -8477,7 +8477,7 @@ void gnutools::Linker::ConstructJob(Comp
 
   if (llvm::sys::path::filename(ToolChain.Linker) == "lld") {
 CmdArgs.push_back("-flavor");
-CmdArgs.push_back("gnu");
+CmdArgs.push_back("old-gnu");
 CmdArgs.push_back("-target");
 CmdArgs.push_back(Args.MakeArgString(getToolChain().getTripleString()));
   }
@@ -9467,7 +9467,7 @@ void MinGW::Linker::ConstructJob(Compila
   StringRef LinkerName = Args.getLastArgValue(options::OPT_fuse_ld_EQ, "ld");
   if (LinkerName.equals_lower("lld")) {
 CmdArgs.push_back("-flavor");
-CmdArgs.push_back("gnu");
+CmdArgs.push_back("old-gnu");
   } else if (!LinkerName.equals_lower("ld")) {
 D.Diag(diag::err_drv_unsupported_linker) << LinkerName;
   }

Modified: cfe/trunk/test/Driver/amdgpu-toolchain.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/amdgpu-toolchain.c?rev=253191=253190=253191=diff
==
--- cfe/trunk/test/Driver/amdgpu-toolchain.c (original)
+++ cfe/trunk/test/Driver/amdgpu-toolchain.c Mon Nov 16 03:12:12 2015
@@ -1,3 +1,3 @@
 // RUN: %clang -### -target amdgcn--amdhsa -x assembler -mcpu=kaveri %s 2>&1 | 
FileCheck -check-prefix=AS_LINK %s
 // AS_LINK: clang{{.*}} "-cc1as"
-// AS_LINK: lld{{.*}} "-flavor" "gnu" "-target" "amdgcn--amdhsa"
+// AS_LINK: lld{{.*}} "-flavor" "old-gnu" "-target" "amdgcn--amdhsa"

Modified: cfe/trunk/test/Driver/mingw-useld.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mingw-useld.c?rev=253191=253190=253191=diff
==
--- cfe/trunk/test/Driver/mingw-useld.c (original)
+++ cfe/trunk/test/Driver/mingw-useld.c Mon Nov 16 03:12:12 2015
@@ -1,16 +1,16 @@
 // RUN: %clang -### -target i686-pc-windows-gnu 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck 
-check-prefix=CHECK_LD_32 %s
 // CHECK_LD_32: {{ld|ld.exe}}"
 // CHECK_LD_32: "i386pe"
-// CHECK_LD_32_NOT: "-flavor" "gnu"
+// CHECK_LD_32_NOT: "-flavor" "old-gnu"
 
 // RUN: %clang -### -target i686-pc-windows-gnu 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 | FileCheck 
-check-prefix=CHECK_LLD_32 %s
-// CHECK_LLD_32: lld" "-flavor" "gnu"
+// CHECK_LLD_32: lld" "-flavor" "old-gnu"
 // CHECK_LLD_32: "i386pe"
 
 // RUN: %clang -### -target x86_64-pc-windows-gnu 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 | FileCheck 
-check-prefix=CHECK_LLD_64 %s
-// CHECK_LLD_64: lld" "-flavor" "gnu"
+// CHECK_LLD_64: lld" "-flavor" "old-gnu"
 // CHECK_LLD_64: "i386pep"
 
 // RUN: %clang -### -target arm-pc-windows-gnu 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -fuse-ld=lld 2>&1 | FileCheck 
-check-prefix=CHECK_LLD_ARM %s
-// CHECK_LLD_ARM: lld" "-flavor" "gnu"
+// CHECK_LLD_ARM: lld" "-flavor" "old-gnu"
 // CHECK_LLD_ARM: "thumb2pe"

Modified: cfe/trunk/test/Driver/mips-mti-linux.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mips-mti-linux.c?rev=253191=253190=253191=diff
==
--- cfe/trunk/test/Driver/mips-mti-linux.c (original)
+++ cfe/trunk/test/Driver/mips-mti-linux.c Mon Nov 16 03:12:12 2015
@@ -14,7 +14,7 @@
 // CHECK-BE-HF-32R2: "{{[^"]*}}clang{{[^"]*}}" {{.*}} "-triple" 
"mips-mti-linux"
 // CHECK-BE-HF-32R2-SAME: "-fuse-init-array" "-target-cpu" "mips32r2"
 // CHECK-BE-HF-32R2-SAME: "-isysroot" "{{.*}}mips_mti_linux/sysroot"
-// CHECK-BE-HF-32R2: "{{[^"]*}}lld{{[^"]*}}" "-flavor" "gnu" "-target" 
"mips-mti-linux"
+// CHECK-BE-HF-32R2: "{{[^"]*}}lld{{[^"]*}}" "-flavor" "old-gnu" "-target" 
"mips-mti-linux"
 // CHECK-BE-HF-32R2-SAME: "--sysroot=[[SYSROOT:[^"]+]]" {{.*}} 
"-dynamic-linker" "/lib/ld-musl-mips.so.1"
 // CHECK-BE-HF-32R2-SAME: 
"[[SYSROOT]]/mips-r2-hard-musl/usr/lib{{/|}}crt1.o"
 // CHECK-BE-HF-32R2-SAME: 

[PATCH] D14695: [libclang] Add entry points that take a full command line including argv[0].

2015-11-16 Thread Benjamin Kramer via cfe-commits
bkramer created this revision.
bkramer added a reviewer: klimek.
bkramer added a subscriber: cfe-commits.

This provides both a more uniform interface and makes libclang behave like
clang tooling wrt relative paths against argv[0]. This is necessary for
finding paths to a c++ standard library relative to a clang binary given
in a compilation database. It can also be used to find paths relative to
libclang.so if the full path to it is passed in.

http://reviews.llvm.org/D14695

Files:
  include/clang-c/Index.h
  lib/Frontend/CreateInvocationFromCommandLine.cpp
  tools/diagtool/ShowEnabledWarnings.cpp
  tools/libclang/CIndex.cpp
  tools/libclang/Indexing.cpp

Index: tools/libclang/Indexing.cpp
===
--- tools/libclang/Indexing.cpp
+++ tools/libclang/Indexing.cpp
@@ -907,6 +907,22 @@
   unsigned num_unsaved_files,
   CXTranslationUnit *out_TU,
   unsigned TU_options) {
+  SmallVector Args;
+  Args.push_back("clang");
+  Args.append(command_line_args, command_line_args + num_command_line_args);
+  return clang_indexSourceFileFullArgv(
+  idxAction, client_data, index_callbacks, index_callbacks_size,
+  index_options, source_filename, Args.data(), Args.size(), unsaved_files,
+  num_unsaved_files, out_TU, TU_options);
+}
+
+int clang_indexSourceFileFullArgv(
+CXIndexAction idxAction, CXClientData client_data,
+IndexerCallbacks *index_callbacks, unsigned index_callbacks_size,
+unsigned index_options, const char *source_filename,
+const char *const *command_line_args, int num_command_line_args,
+struct CXUnsavedFile *unsaved_files, unsigned num_unsaved_files,
+CXTranslationUnit *out_TU, unsigned TU_options) {
   LOG_FUNC_SECTION {
 *Log << source_filename << ": ";
 for (int i = 0; i != num_command_line_args; ++i)
Index: tools/libclang/CIndex.cpp
===
--- tools/libclang/CIndex.cpp
+++ tools/libclang/CIndex.cpp
@@ -3089,12 +3089,12 @@
   break;
 }
   }
-  if (!FoundSpellCheckingArgument)
-Args->push_back("-fno-spell-checking");
-  
   Args->insert(Args->end(), command_line_args,
command_line_args + num_command_line_args);
 
+  if (!FoundSpellCheckingArgument)
+Args->insert(Args->begin() + 1, "-fno-spell-checking");
+
   // The 'source_filename' argument is optional.  If the caller does not
   // specify it then it is assumed that the source file is specified
   // in the actual argument list.
@@ -3157,14 +3157,23 @@
 }
 
 enum CXErrorCode clang_parseTranslationUnit2(
-CXIndex CIdx,
-const char *source_filename,
-const char *const *command_line_args,
-int num_command_line_args,
-struct CXUnsavedFile *unsaved_files,
-unsigned num_unsaved_files,
-unsigned options,
-CXTranslationUnit *out_TU) {
+CXIndex CIdx, const char *source_filename,
+const char *const *command_line_args, int num_command_line_args,
+struct CXUnsavedFile *unsaved_files, unsigned num_unsaved_files,
+unsigned options, CXTranslationUnit *out_TU) {
+  SmallVector Args;
+  Args.push_back("clang");
+  Args.append(command_line_args, command_line_args + num_command_line_args);
+  return clang_parseTranslationUnit2FullArgv(
+  CIdx, source_filename, Args.data(), Args.size(), unsaved_files,
+  num_unsaved_files, options, out_TU);
+}
+
+enum CXErrorCode clang_parseTranslationUnit2FullArgv(
+CXIndex CIdx, const char *source_filename,
+const char *const *command_line_args, int num_command_line_args,
+struct CXUnsavedFile *unsaved_files, unsigned num_unsaved_files,
+unsigned options, CXTranslationUnit *out_TU) {
   LOG_FUNC_SECTION {
 *Log << source_filename << ": ";
 for (int i = 0; i != num_command_line_args; ++i)
Index: tools/diagtool/ShowEnabledWarnings.cpp
===
--- tools/diagtool/ShowEnabledWarnings.cpp
+++ tools/diagtool/ShowEnabledWarnings.cpp
@@ -64,9 +64,11 @@
 new DiagnosticsEngine(DiagIDs, new DiagnosticOptions(), DiagsBuffer));
 
   // Try to build a CompilerInvocation.
+  SmallVector Args;
+  Args.push_back("diagtool");
+  Args.append(argv, argv + argc);
   std::unique_ptr Invocation(
-  createInvocationFromCommandLine(llvm::makeArrayRef(argv, argc),
-  InterimDiags));
+  createInvocationFromCommandLine(Args, InterimDiags));
   if (!Invocation)
 return nullptr;
 
Index: lib/Frontend/CreateInvocationFromCommandLine.cpp
===
--- lib/Frontend/CreateInvocationFromCommandLine.cpp
+++ lib/Frontend/CreateInvocationFromCommandLine.cpp
@@ -39,15 +39,13 @@
 Diags = CompilerInstance::createDiagnostics(new DiagnosticOptions);
   }
 
-  SmallVector Args;
-  Args.push_back(""); // FIXME: Remove dummy argument.
-  Args.insert(Args.end(), 

Re: [PATCH] D10599: [OPENMP 4.0] Initial support for '#pragma omp declare simd' directive.

2015-11-16 Thread Alexey Bataev via cfe-commits
ABataev updated this revision to Diff 40255.
ABataev marked 4 inline comments as done.
ABataev added a comment.

Update after review


http://reviews.llvm.org/D10599

Files:
  include/clang/Basic/Attr.td
  include/clang/Basic/AttrDocs.td
  include/clang/Basic/DiagnosticParseKinds.td
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Basic/OpenMPKinds.def
  include/clang/Parse/Parser.h
  include/clang/Sema/Sema.h
  lib/Basic/OpenMPKinds.cpp
  lib/Parse/ParseDecl.cpp
  lib/Parse/ParseDeclCXX.cpp
  lib/Parse/ParseOpenMP.cpp
  lib/Parse/Parser.cpp
  lib/Sema/SemaOpenMP.cpp
  test/OpenMP/declare_simd_ast_print.c
  test/OpenMP/declare_simd_ast_print.cpp
  test/OpenMP/declare_simd_messages.cpp

Index: lib/Parse/Parser.cpp
===
--- lib/Parse/Parser.cpp
+++ lib/Parse/Parser.cpp
@@ -656,8 +656,10 @@
   case tok::annot_pragma_opencl_extension:
 HandlePragmaOpenCLExtension();
 return DeclGroupPtrTy();
-  case tok::annot_pragma_openmp:
-return ParseOpenMPDeclarativeDirective();
+  case tok::annot_pragma_openmp: {
+AccessSpecifier AS = AS_none;
+return ParseOpenMPDeclarativeDirectiveWithExtDecl(AS, attrs);
+  }
   case tok::annot_pragma_ms_pointers_to_members:
 HandlePragmaMSPointersToMembers();
 return DeclGroupPtrTy();
Index: lib/Parse/ParseOpenMP.cpp
===
--- lib/Parse/ParseOpenMP.cpp
+++ lib/Parse/ParseOpenMP.cpp
@@ -31,6 +31,7 @@
   // E.g.: OMPD_for OMPD_simd ===> OMPD_for_simd
   // TODO: add other combined directives in topological order.
   const OpenMPDirectiveKind F[][3] = {
+  {OMPD_unknown /*declare*/, OMPD_simd, OMPD_declare_simd},
   {OMPD_unknown /*cancellation*/, OMPD_unknown /*point*/,
OMPD_cancellation_point},
   {OMPD_target, OMPD_unknown /*data*/, OMPD_target_data},
@@ -48,11 +49,12 @@
   for (unsigned i = 0; i < llvm::array_lengthof(F); ++i) {
 if (!Tok.isAnnotation() && DKind == OMPD_unknown) {
   TokenMatched =
-  (i == 0) &&
-  !P.getPreprocessor().getSpelling(Tok).compare("cancellation");
-} else {
+  ((i == 0) &&
+   !P.getPreprocessor().getSpelling(Tok).compare("declare")) ||
+  ((i == 1) &&
+   !P.getPreprocessor().getSpelling(Tok).compare("cancellation"));
+} else
   TokenMatched = DKind == F[i][0] && DKind != OMPD_unknown;
-}
 
 if (TokenMatched) {
   Tok = P.getPreprocessor().LookAhead(0);
@@ -64,12 +66,11 @@
 
   if (!TokenIsAnnotation && SDKind == OMPD_unknown) {
 TokenMatched =
-((i == 0) &&
+((i == 1) &&
  !P.getPreprocessor().getSpelling(Tok).compare("point")) ||
-((i == 1) && !P.getPreprocessor().getSpelling(Tok).compare("data"));
-  } else {
+((i == 2) && !P.getPreprocessor().getSpelling(Tok).compare("data"));
+  } else
 TokenMatched = SDKind == F[i][1] && SDKind != OMPD_unknown;
-  }
 
   if (TokenMatched) {
 P.ConsumeToken();
@@ -84,8 +85,16 @@
 ///
 ///   threadprivate-directive:
 /// annot_pragma_openmp 'threadprivate' simple-variable-list
+/// annot_pragma_omp_end
 ///
-Parser::DeclGroupPtrTy Parser::ParseOpenMPDeclarativeDirective() {
+///   declare-simd-directive:
+/// annot_pragma_openmp 'declare simd' { [,]}
+/// annot_pragma_omp_end
+/// 
+///
+Parser::DeclGroupPtrTy Parser::ParseOpenMPDeclarativeDirectiveWithExtDecl(
+AccessSpecifier , ParsedAttributesWithRange ,
+DeclSpec::TST TagType, Decl *Tag) {
   assert(Tok.is(tok::annot_pragma_openmp) && "Not an OpenMP directive!");
   ParenBraceBracketBalancer BalancerRAIIObj(*this);
 
@@ -109,6 +118,47 @@
   return Actions.ActOnOpenMPThreadprivateDirective(Loc, Identifiers);
 }
 break;
+  case OMPD_declare_simd: {
+// The syntax is:
+// { #pragma omp declare simd }
+// 
+//
+
+ConsumeToken();
+// The last seen token is annot_pragma_openmp_end - need to check for
+// extra tokens.
+if (Tok.isNot(tok::annot_pragma_openmp_end)) {
+  Diag(Tok, diag::warn_omp_extra_tokens_at_eol)
+  << getOpenMPDirectiveName(OMPD_declare_simd);
+  while (Tok.isNot(tok::annot_pragma_openmp_end))
+ConsumeAnyToken();
+}
+// Skip the last annot_pragma_openmp_end.
+ConsumeToken();
+
+DeclGroupPtrTy Ptr;
+if (Tok.is(tok::annot_pragma_openmp)) {
+  Ptr = ParseOpenMPDeclarativeDirectiveWithExtDecl(AS, Attrs, TagType, Tag);
+} else if (Tok.isNot(tok::r_brace) && !isEofOrEom()) {
+  // Here we expect to see some function declaration.
+  if (AS == AS_none) {
+assert(TagType == DeclSpec::TST_unspecified);
+MaybeParseCXX11Attributes(Attrs);
+MaybeParseMicrosoftAttributes(Attrs);
+ParsingDeclSpec PDS(*this);
+Ptr = ParseExternalDeclaration(Attrs, );
+  } else {
+Ptr =
+

Re: [PATCH] D14695: [libclang] Add entry points that take a full command line including argv[0].

2015-11-16 Thread Manuel Klimek via cfe-commits
klimek added inline comments.


Comment at: include/clang-c/Index.h:5694-5695
@@ -5683,1 +5693,4 @@
 /**
+ * \brief Same as clang_indexSourceFile but requires a full command line
+ * for \c command_line_args including argv[0].
+ */

We should probably expand on why users would want to use on or the other here...


http://reviews.llvm.org/D14695



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


Re: [PATCH] D11182: [OPENMP 4.0] Initial support for 'omp declare reduction' construct.

2015-11-16 Thread Alexey Bataev via cfe-commits
ABataev updated this revision to Diff 40262.
ABataev marked 2 inline comments as done.
ABataev added a comment.

Update after review


http://reviews.llvm.org/D11182

Files:
  include/clang/AST/DataRecursiveASTVisitor.h
  include/clang/AST/DeclBase.h
  include/clang/AST/DeclCXX.h
  include/clang/AST/DeclOpenMP.h
  include/clang/AST/RecursiveASTVisitor.h
  include/clang/Basic/DeclNodes.td
  include/clang/Basic/DiagnosticParseKinds.td
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Basic/OpenMPKinds.def
  include/clang/Parse/Parser.h
  include/clang/Sema/ScopeInfo.h
  include/clang/Sema/Sema.h
  include/clang/Serialization/ASTBitCodes.h
  lib/AST/CXXInheritance.cpp
  lib/AST/Decl.cpp
  lib/AST/DeclBase.cpp
  lib/AST/DeclOpenMP.cpp
  lib/AST/DeclPrinter.cpp
  lib/AST/ItaniumMangle.cpp
  lib/AST/MicrosoftMangle.cpp
  lib/Basic/OpenMPKinds.cpp
  lib/CodeGen/CGDecl.cpp
  lib/CodeGen/CodeGenModule.cpp
  lib/CodeGen/CodeGenModule.h
  lib/Parse/ParseDecl.cpp
  lib/Parse/ParseDeclCXX.cpp
  lib/Parse/ParseOpenMP.cpp
  lib/Parse/Parser.cpp
  lib/Sema/ScopeInfo.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaExpr.cpp
  lib/Sema/SemaLookup.cpp
  lib/Sema/SemaOpenMP.cpp
  lib/Sema/SemaTemplateInstantiateDecl.cpp
  lib/Serialization/ASTCommon.cpp
  lib/Serialization/ASTReaderDecl.cpp
  lib/Serialization/ASTWriterDecl.cpp
  test/OpenMP/declare_reduction_ast_print.c
  test/OpenMP/declare_reduction_ast_print.cpp
  test/OpenMP/declare_reduction_messages.c
  test/OpenMP/declare_reduction_messages.cpp
  tools/libclang/CIndex.cpp

Index: lib/Serialization/ASTWriterDecl.cpp
===
--- lib/Serialization/ASTWriterDecl.cpp
+++ lib/Serialization/ASTWriterDecl.cpp
@@ -131,6 +131,7 @@
 void VisitObjCPropertyDecl(ObjCPropertyDecl *D);
 void VisitObjCPropertyImplDecl(ObjCPropertyImplDecl *D);
 void VisitOMPThreadPrivateDecl(OMPThreadPrivateDecl *D);
+void VisitOMPDeclareReductionDecl(OMPDeclareReductionDecl *D);
 
 /// Add an Objective-C type parameter list to the given record.
 void AddObjCTypeParamList(ObjCTypeParamList *typeParams) {
@@ -1617,6 +1618,16 @@
   Code = serialization::DECL_OMP_THREADPRIVATE;
 }
 
+void ASTDeclWriter::VisitOMPDeclareReductionDecl(OMPDeclareReductionDecl *D) {
+  VisitNamedDecl(D);
+  Writer.AddSourceLocation(D->getLocStart(), Record);
+  Writer.AddStmt(D->getCombiner());
+  Writer.AddStmt(D->getInitializer());
+  Writer.AddDeclRef(D->getPrevDeclInScope(), Record);
+  Writer.AddTypeRef(D->getType(), Record);
+  Code = serialization::DECL_OMP_DECLARE_REDUCTION;
+}
+
 //===--===//
 // ASTWriter Implementation
 //===--===//
Index: lib/Serialization/ASTReaderDecl.cpp
===
--- lib/Serialization/ASTReaderDecl.cpp
+++ lib/Serialization/ASTReaderDecl.cpp
@@ -349,6 +349,7 @@
 void VisitObjCPropertyDecl(ObjCPropertyDecl *D);
 void VisitObjCPropertyImplDecl(ObjCPropertyImplDecl *D);
 void VisitOMPThreadPrivateDecl(OMPThreadPrivateDecl *D);
+void VisitOMPDeclareReductionDecl(OMPDeclareReductionDecl *D);
 
 /// We've merged the definition \p MergedDef into the existing definition
 /// \p Def. Ensure that \p Def is made visible whenever \p MergedDef is made
@@ -2349,6 +2350,15 @@
   D->setVars(Vars);
 }
 
+void ASTDeclReader::VisitOMPDeclareReductionDecl(OMPDeclareReductionDecl *D) {
+  VisitNamedDecl(D);
+  D->setLocation(Reader.ReadSourceLocation(F, Record, Idx));
+  D->setCombiner(Reader.ReadExpr(F));
+  D->setInitializer(Reader.ReadExpr(F));
+  D->PrevDeclInScope = Reader.ReadDeclID(F, Record, Idx);
+  D->setType(Reader.readType(F, Record, Idx));
+}
+
 //===--===//
 // Attribute Reading
 //===--===//
@@ -2398,7 +2408,8 @@
   isa(D) || 
   isa(D) ||
   isa(D) ||
-  isa(D))
+  isa(D) ||
+  isa(D))
 return true;
   if (VarDecl *Var = dyn_cast(D))
 return Var->isFileVarDecl() &&
@@ -3294,6 +3305,9 @@
   case DECL_OMP_THREADPRIVATE:
 D = OMPThreadPrivateDecl::CreateDeserialized(Context, ID, Record[Idx++]);
 break;
+  case DECL_OMP_DECLARE_REDUCTION:
+D = OMPDeclareReductionDecl::CreateDeserialized(Context, ID);
+break;
   case DECL_EMPTY:
 D = EmptyDecl::CreateDeserialized(Context, ID);
 break;
Index: lib/Serialization/ASTCommon.cpp
===
--- lib/Serialization/ASTCommon.cpp
+++ lib/Serialization/ASTCommon.cpp
@@ -329,6 +329,7 @@
   case Decl::ClassScopeFunctionSpecialization:
   case Decl::Import:
   case Decl::OMPThreadPrivate:
+  case Decl::OMPDeclareReduction:
 return false;
 
   // These indirectly derive from Redeclarable but are not actually
Index: 

Re: [PATCH] D14662: [ARM] Pass architecture to TargetParser defaulting to cope with API change

2015-11-16 Thread Bradley Smith via cfe-commits
bsmith closed this revision.
bsmith added a comment.

Thanks, committed as r253199.


Repository:
  rL LLVM

http://reviews.llvm.org/D14662



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


Re: [PATCH] D14695: [libclang] Add entry points that take a full command line including argv[0].

2015-11-16 Thread Benjamin Kramer via cfe-commits
bkramer updated this revision to Diff 40269.
bkramer added a comment.

- Add a test case to make sure argv[0] handling actually works.
- Clarify comments a bit.


http://reviews.llvm.org/D14695

Files:
  include/clang-c/Index.h
  lib/Frontend/CreateInvocationFromCommandLine.cpp
  tools/diagtool/ShowEnabledWarnings.cpp
  tools/libclang/CIndex.cpp
  tools/libclang/Indexing.cpp
  tools/libclang/libclang.exports
  unittests/libclang/LibclangTest.cpp

Index: unittests/libclang/LibclangTest.cpp
===
--- unittests/libclang/LibclangTest.cpp
+++ unittests/libclang/LibclangTest.cpp
@@ -379,8 +379,10 @@
   Filename = Path.str();
   Files.insert(Filename);
 }
+llvm::sys::fs::create_directories(llvm::sys::path::parent_path(Filename));
 std::ofstream OS(Filename);
 OS << Contents;
+assert(OS.good());
   }
   void DisplayDiagnostics() {
 unsigned NumDiagnostics = clang_getNumDiagnostics(ClangTU);
@@ -465,3 +467,27 @@
   ASSERT_TRUE(ReparseTU(0, nullptr /* No unsaved files. */));
   EXPECT_EQ(0U, clang_getNumDiagnostics(ClangTU));
 }
+
+TEST_F(LibclangReparseTest, clang_parseTranslationUnit2FullArgv) {
+  std::string EmptyFiles[] = {"lib/gcc/arm-linux-gnueabi/4.6.1/crtbegin.o",
+  "include/arm-linux-gnueabi/.keep",
+  "include/c++/4.6.1/vector"};
+
+  for (auto  : EmptyFiles)
+WriteFile(Name, "\n");
+
+  std::string Filename = "test.cc";
+  WriteFile(Filename, "#include \n");
+
+  std::string Clang = "bin/clang";
+  WriteFile(Clang, "");
+
+  const char *Argv[] = {Clang.c_str(), "-target", "arm-linux-gnueabi"};
+
+  EXPECT_EQ(CXError_Success,
+clang_parseTranslationUnit2FullArgv(Index, Filename.c_str(), Argv,
+sizeof(Argv) / sizeof(Argv[0]),
+nullptr, 0, TUFlags, ));
+  EXPECT_EQ(0U, clang_getNumDiagnostics(ClangTU));
+  DisplayDiagnostics();
+}
Index: tools/libclang/libclang.exports
===
--- tools/libclang/libclang.exports
+++ tools/libclang/libclang.exports
@@ -249,6 +249,7 @@
 clang_indexLoc_getCXSourceLocation
 clang_indexLoc_getFileLocation
 clang_indexSourceFile
+clang_indexSourceFileFullArgv
 clang_indexTranslationUnit
 clang_index_getCXXClassDeclInfo
 clang_index_getClientContainer
@@ -284,6 +285,7 @@
 clang_Location_isFromMainFile
 clang_parseTranslationUnit
 clang_parseTranslationUnit2
+clang_parseTranslationUnit2FullArgv
 clang_remap_dispose
 clang_remap_getFilenames
 clang_remap_getNumFiles
Index: tools/libclang/Indexing.cpp
===
--- tools/libclang/Indexing.cpp
+++ tools/libclang/Indexing.cpp
@@ -907,6 +907,22 @@
   unsigned num_unsaved_files,
   CXTranslationUnit *out_TU,
   unsigned TU_options) {
+  SmallVector Args;
+  Args.push_back("clang");
+  Args.append(command_line_args, command_line_args + num_command_line_args);
+  return clang_indexSourceFileFullArgv(
+  idxAction, client_data, index_callbacks, index_callbacks_size,
+  index_options, source_filename, Args.data(), Args.size(), unsaved_files,
+  num_unsaved_files, out_TU, TU_options);
+}
+
+int clang_indexSourceFileFullArgv(
+CXIndexAction idxAction, CXClientData client_data,
+IndexerCallbacks *index_callbacks, unsigned index_callbacks_size,
+unsigned index_options, const char *source_filename,
+const char *const *command_line_args, int num_command_line_args,
+struct CXUnsavedFile *unsaved_files, unsigned num_unsaved_files,
+CXTranslationUnit *out_TU, unsigned TU_options) {
   LOG_FUNC_SECTION {
 *Log << source_filename << ": ";
 for (int i = 0; i != num_command_line_args; ++i)
Index: tools/libclang/CIndex.cpp
===
--- tools/libclang/CIndex.cpp
+++ tools/libclang/CIndex.cpp
@@ -3089,12 +3089,12 @@
   break;
 }
   }
-  if (!FoundSpellCheckingArgument)
-Args->push_back("-fno-spell-checking");
-  
   Args->insert(Args->end(), command_line_args,
command_line_args + num_command_line_args);
 
+  if (!FoundSpellCheckingArgument)
+Args->insert(Args->begin() + 1, "-fno-spell-checking");
+
   // The 'source_filename' argument is optional.  If the caller does not
   // specify it then it is assumed that the source file is specified
   // in the actual argument list.
@@ -3157,14 +3157,23 @@
 }
 
 enum CXErrorCode clang_parseTranslationUnit2(
-CXIndex CIdx,
-const char *source_filename,
-const char *const *command_line_args,
-int num_command_line_args,
-struct CXUnsavedFile *unsaved_files,
-unsigned num_unsaved_files,
-unsigned options,
-CXTranslationUnit *out_TU) {
+CXIndex CIdx, const char *source_filename,
+const char *const