r280057 - Combine two FileCheck patterns to prevent overzealous matching of .*

2016-08-29 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Tue Aug 30 00:14:38 2016
New Revision: 280057

URL: http://llvm.org/viewvc/llvm-project?rev=280057=rev
Log:
Combine two FileCheck patterns to prevent overzealous matching of .*

Modified:
cfe/trunk/test/Driver/modules-ts.cpp

Modified: cfe/trunk/test/Driver/modules-ts.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/modules-ts.cpp?rev=280057=280056=280057=diff
==
--- cfe/trunk/test/Driver/modules-ts.cpp (original)
+++ cfe/trunk/test/Driver/modules-ts.cpp Tue Aug 30 00:14:38 2016
@@ -23,8 +23,7 @@
 // CHECK-USE: -cc1
 // CHECK-USE-SAME: -emit-obj
 // CHECK-USE-SAME: -fmodule-file={{.*}}.pcm
-// CHECK-USE-SAME: -o {{.*}}.o
-// CHECK-USE-SAME: -x c++
+// CHECK-USE-SAME: -o {{.*}}.o {{.*}}-x c++
 // CHECK-USE-SAME: modules-ts.cpp
 
 // Check combining precompile and compile steps works.


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


r280053 - [PowerPC] Update the DWARF register-size table

2016-08-29 Thread Hal Finkel via cfe-commits
Author: hfinkel
Date: Mon Aug 29 21:38:34 2016
New Revision: 280053

URL: http://llvm.org/viewvc/llvm-project?rev=280053=rev
Log:
[PowerPC] Update the DWARF register-size table

The PPC64 DWARF register-size table did not match the ABI specification (or
GCC, for that matter). Fix that, and add a regression test.

Fixes PR27931.

Added:
cfe/trunk/test/CodeGen/ppc64-dwarf.c
Modified:
cfe/trunk/lib/CodeGen/TargetInfo.cpp

Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=280053=280052=280053=diff
==
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Mon Aug 29 21:38:34 2016
@@ -4413,14 +4413,17 @@ PPC64_initDwarfEHRegSizeTable(CodeGen::C
   // 32-63: fp0-31, the 8-byte floating-point registers
   AssignToArrayRange(Builder, Address, Eight8, 32, 63);
 
-  // 64-76 are various 4-byte special-purpose registers:
+  // 64-67 are various 8-byte special-purpose registers:
   // 64: mq
   // 65: lr
   // 66: ctr
   // 67: ap
+  AssignToArrayRange(Builder, Address, Eight8, 64, 67);
+
+  // 68-76 are various 4-byte special-purpose registers:
   // 68-75 cr0-7
   // 76: xer
-  AssignToArrayRange(Builder, Address, Four8, 64, 76);
+  AssignToArrayRange(Builder, Address, Four8, 68, 76);
 
   // 77-108: v0-31, the 16-byte vector registers
   AssignToArrayRange(Builder, Address, Sixteen8, 77, 108);
@@ -4430,7 +4433,10 @@ PPC64_initDwarfEHRegSizeTable(CodeGen::C
   // 111: spe_acc
   // 112: spefscr
   // 113: sfp
-  AssignToArrayRange(Builder, Address, Four8, 109, 113);
+  // 114: tfhar
+  // 115: tfiar
+  // 116: texasr
+  AssignToArrayRange(Builder, Address, Eight8, 109, 116);
 
   return false;
 }

Added: cfe/trunk/test/CodeGen/ppc64-dwarf.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ppc64-dwarf.c?rev=280053=auto
==
--- cfe/trunk/test/CodeGen/ppc64-dwarf.c (added)
+++ cfe/trunk/test/CodeGen/ppc64-dwarf.c Mon Aug 29 21:38:34 2016
@@ -0,0 +1,129 @@
+// RUN: %clang_cc1 -triple powerpc64-unknown-unknown -emit-llvm %s -o - | 
FileCheck %s
+static unsigned char dwarf_reg_size_table[1024];
+
+int test() {
+  __builtin_init_dwarf_reg_size_table(dwarf_reg_size_table);
+
+  return __builtin_dwarf_sp_column();
+}
+
+// CHECK-LABEL: define signext i32 @test()
+// CHECK:  store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x 
i8]* @dwarf_reg_size_table, i32 0, i32 0), align 1
+// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x 
i8]* @dwarf_reg_size_table, i32 0, i32 1), align 1
+// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x 
i8]* @dwarf_reg_size_table, i32 0, i32 2), align 1
+// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x 
i8]* @dwarf_reg_size_table, i32 0, i32 3), align 1
+// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x 
i8]* @dwarf_reg_size_table, i32 0, i32 4), align 1
+// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x 
i8]* @dwarf_reg_size_table, i32 0, i32 5), align 1
+// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x 
i8]* @dwarf_reg_size_table, i32 0, i32 6), align 1
+// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x 
i8]* @dwarf_reg_size_table, i32 0, i32 7), align 1
+// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x 
i8]* @dwarf_reg_size_table, i32 0, i32 8), align 1
+// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x 
i8]* @dwarf_reg_size_table, i32 0, i32 9), align 1
+// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x 
i8]* @dwarf_reg_size_table, i32 0, i32 10), align 1
+// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x 
i8]* @dwarf_reg_size_table, i32 0, i32 11), align 1
+// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x 
i8]* @dwarf_reg_size_table, i32 0, i32 12), align 1
+// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x 
i8]* @dwarf_reg_size_table, i32 0, i32 13), align 1
+// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x 
i8]* @dwarf_reg_size_table, i32 0, i32 14), align 1
+// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x 
i8]* @dwarf_reg_size_table, i32 0, i32 15), align 1
+// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x 
i8]* @dwarf_reg_size_table, i32 0, i32 16), align 1
+// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x 
i8]* @dwarf_reg_size_table, i32 0, i32 17), align 1
+// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x i8], [1024 x 
i8]* @dwarf_reg_size_table, i32 0, i32 18), align 1
+// CHECK-NEXT: store i8 8, i8* getelementptr inbounds ([1024 x 

[libcxx] r280050 - Add "FLAKY_TEST" test directive to support re-running flaky tests.

2016-08-29 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Mon Aug 29 20:46:43 2016
New Revision: 280050

URL: http://llvm.org/viewvc/llvm-project?rev=280050=rev
Log:
Add "FLAKY_TEST" test directive to support re-running flaky tests.

Some of the mutex tests fail on machines with high load. This patch implements
the test directive "// FLAKY_TEST" which allows a test to be run 3 times
before it's considered a failure.

Modified:
libcxx/trunk/test/libcxx/test/format.py

libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex.pass.cpp

libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_duration.pass.cpp

libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex_time_point.pass.cpp

libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_duration.pass.cpp

libcxx/trunk/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/thread.lock.unique.cons/mutex_time_point.pass.cpp

libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/lock.pass.cpp

libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/lock_shared.pass.cpp

libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.shared_mutex.requirements/thread.shared_mutex.class/try_lock_shared.pass.cpp

libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/lock.pass.cpp

libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/lock_shared.pass.cpp

libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_for.pass.cpp

libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared.pass.cpp

libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_for.pass.cpp

libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_shared_until.pass.cpp

libcxx/trunk/test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/try_lock_until.pass.cpp

Modified: libcxx/trunk/test/libcxx/test/format.py
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/test/format.py?rev=280050=280049=280050=diff
==
--- libcxx/trunk/test/libcxx/test/format.py (original)
+++ libcxx/trunk/test/libcxx/test/format.py Mon Aug 29 20:46:43 2016
@@ -114,6 +114,9 @@ class LibcxxTestFormat(object):
 def _evaluate_pass_test(self, test, tmpBase, lit_config):
 execDir = os.path.dirname(test.getExecPath())
 source_path = test.getSourcePath()
+with open(source_path, 'r') as f:
+contents = f.read()
+is_flaky = 'FLAKY_TEST' in contents
 exec_path = tmpBase + '.exe'
 object_path = tmpBase + '.o'
 # Create the output directory if it does not already exist.
@@ -139,14 +142,21 @@ class LibcxxTestFormat(object):
 # should add a `// FILE-DEP: foo.dat` to each test to track this.
 data_files = [os.path.join(local_cwd, f)
   for f in os.listdir(local_cwd) if f.endswith('.dat')]
-cmd, out, err, rc = self.executor.run(exec_path, [exec_path],
-  local_cwd, data_files, env)
-if rc != 0:
-report = libcxx.util.makeReport(cmd, out, err, rc)
-report = "Compiled With: %s\n%s" % (compile_cmd, report)
-report += "Compiled test failed unexpectedly!"
-return lit.Test.FAIL, report
-return lit.Test.PASS, ''
+max_retry = 3 if is_flaky else 1
+for retry_count in range(max_retry):
+cmd, out, err, rc = self.executor.run(exec_path, [exec_path],
+  local_cwd, data_files,
+  env)
+if rc == 0:
+res = lit.Test.PASS if retry_count == 0 else 
lit.Test.FLAKYPASS
+return res, ''
+elif rc != 0 and retry_count + 1 == max_retry:
+report = libcxx.util.makeReport(cmd, out, err, rc)
+report = "Compiled With: %s\n%s" % (compile_cmd, report)
+report += "Compiled test failed unexpectedly!"
+

r280044 - [sanitizer-coverage] add two more modes of instrumentation: trace-div and trace-gep, mostly usaful for value-profile-based fuzzing; clang part

2016-08-29 Thread Kostya Serebryany via cfe-commits
Author: kcc
Date: Mon Aug 29 20:27:03 2016
New Revision: 280044

URL: http://llvm.org/viewvc/llvm-project?rev=280044=rev
Log:
[sanitizer-coverage] add two more modes of instrumentation: trace-div and 
trace-gep, mostly usaful for value-profile-based fuzzing; clang part

Modified:
cfe/trunk/docs/SanitizerCoverage.rst
cfe/trunk/include/clang/Driver/CC1Options.td
cfe/trunk/include/clang/Frontend/CodeGenOptions.def
cfe/trunk/lib/CodeGen/BackendUtil.cpp
cfe/trunk/lib/Driver/SanitizerArgs.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/Driver/fsanitize-coverage.c

Modified: cfe/trunk/docs/SanitizerCoverage.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/SanitizerCoverage.rst?rev=280044=280043=280044=diff
==
--- cfe/trunk/docs/SanitizerCoverage.rst (original)
+++ cfe/trunk/docs/SanitizerCoverage.rst Mon Aug 29 20:27:03 2016
@@ -324,11 +324,14 @@ and can be used with `AFL `_
+(to capture array indices).
 
 .. code-block:: c++
 
@@ -346,6 +349,16 @@ they will be called by the instrumented
   // Cases[2:] are the case constants.
   void __sanitizer_cov_trace_switch(uint64_t Val, uint64_t *Cases);
 
+  // Called before a division statement.
+  // Val is the second argument of division.
+  void __sanitizer_cov_trace_div4(uint32_t Val);
+  void __sanitizer_cov_trace_div8(uint64_t Val);
+
+  // Called before a GetElemementPtr (GEP) instruction
+  // for every non-constant array index.
+  void __sanitizer_cov_trace_gep(uintptr_t Idx);
+
+
 This interface is a subject to change.
 The current implementation is not thread-safe and thus can be safely used only 
for single-threaded targets.
 

Modified: cfe/trunk/include/clang/Driver/CC1Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=280044=280043=280044=diff
==
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Mon Aug 29 20:27:03 2016
@@ -272,6 +272,12 @@ def fsanitize_coverage_trace_bb
 def fsanitize_coverage_trace_cmp
 : Flag<["-"], "fsanitize-coverage-trace-cmp">,
   HelpText<"Enable cmp instruction tracing in sanitizer coverage">;
+def fsanitize_coverage_trace_div
+: Flag<["-"], "fsanitize-coverage-trace-div">,
+  HelpText<"Enable div instruction tracing in sanitizer coverage">;
+def fsanitize_coverage_trace_gep
+: Flag<["-"], "fsanitize-coverage-trace-gep">,
+  HelpText<"Enable gep instruction tracing in sanitizer coverage">;
 def fsanitize_coverage_8bit_counters
 : Flag<["-"], "fsanitize-coverage-8bit-counters">,
   HelpText<"Enable frequency counters in sanitizer coverage">;

Modified: cfe/trunk/include/clang/Frontend/CodeGenOptions.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CodeGenOptions.def?rev=280044=280043=280044=diff
==
--- cfe/trunk/include/clang/Frontend/CodeGenOptions.def (original)
+++ cfe/trunk/include/clang/Frontend/CodeGenOptions.def Mon Aug 29 20:27:03 2016
@@ -151,6 +151,10 @@ CODEGENOPT(SanitizeCoverageTraceBB, 1, 0
   ///< in sanitizer coverage.
 CODEGENOPT(SanitizeCoverageTraceCmp, 1, 0) ///< Enable cmp instruction tracing
///< in sanitizer coverage.
+CODEGENOPT(SanitizeCoverageTraceDiv, 1, 0) ///< Enable div instruction tracing
+   ///< in sanitizer coverage.
+CODEGENOPT(SanitizeCoverageTraceGep, 1, 0) ///< Enable GEP instruction tracing
+   ///< in sanitizer coverage.
 CODEGENOPT(SanitizeCoverage8bitCounters, 1, 0) ///< Use 8-bit frequency 
counters
///< in sanitizer coverage.
 CODEGENOPT(SanitizeCoverageTracePC, 1, 0) ///< Enable PC tracing

Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=280044=280043=280044=diff
==
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp 

[libcxx] r280042 - Fix syntax error in recent CMake change.

2016-08-29 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Mon Aug 29 20:10:33 2016
New Revision: 280042

URL: http://llvm.org/viewvc/llvm-project?rev=280042=rev
Log:
Fix syntax error in recent CMake change.

Modified:
libcxx/trunk/lib/CMakeLists.txt

Modified: libcxx/trunk/lib/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/CMakeLists.txt?rev=280042=280041=280042=diff
==
--- libcxx/trunk/lib/CMakeLists.txt (original)
+++ libcxx/trunk/lib/CMakeLists.txt Mon Aug 29 20:10:33 2016
@@ -106,7 +106,7 @@ if ( APPLE AND (LIBCXX_CXX_ABI_LIBNAME S
   "/usr/lib/libSystem.B.dylib")
   else()
 if (DEFINED CMAKE_OSX_SYSROOT)
-  list(FIND ${CMAKE_OSX_ARCHITECTURES} "armv7" OSX_HAS_ARMV7)
+  list(FIND CMAKE_OSX_ARCHITECTURES "armv7" OSX_HAS_ARMV7)
   if (NOT OSX_HAS_ARMV7 EQUAL -1)
 set(OSX_RE_EXPORT_LINE
   "${CMAKE_OSX_SYSROOT}/usr/lib/libc++abi.dylib"


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


r280041 - [PowerPC] Add support for -mlongcall

2016-08-29 Thread Hal Finkel via cfe-commits
Author: hfinkel
Date: Mon Aug 29 20:07:03 2016
New Revision: 280041

URL: http://llvm.org/viewvc/llvm-project?rev=280041=rev
Log:
[PowerPC] Add support for -mlongcall

Add support for GCC's PowerPC -mlongcall option; the backend supports the
corresponding target feature as of r280040.

Fixes PR19098.

Modified:
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/test/Driver/ppc-features.cpp

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=280041=280040=280041=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Mon Aug 29 20:07:03 2016
@@ -1598,6 +1598,10 @@ def mfloat128: Flag<["-"], "mfloat128">,
 Group;
 def mno_float128 : Flag<["-"], "mno-float128">,
 Group;
+def mlongcall: Flag<["-"], "mlongcall">,
+Group;
+def mno_longcall : Flag<["-"], "mno-longcall">,
+Group;
 
 def faltivec : Flag<["-"], "faltivec">, Group, Flags<[CC1Option]>,
   HelpText<"Enable AltiVec vector initializer syntax">;

Modified: cfe/trunk/test/Driver/ppc-features.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/ppc-features.cpp?rev=280041=280040=280041=diff
==
--- cfe/trunk/test/Driver/ppc-features.cpp (original)
+++ cfe/trunk/test/Driver/ppc-features.cpp Mon Aug 29 20:07:03 2016
@@ -163,6 +163,12 @@
 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-crbits -mcrbits 
-### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-CRBITS %s
 // CHECK-CRBITS: "-target-feature" "+crbits"
 
+// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-longcall -### -o 
%t.o 2>&1 | FileCheck -check-prefix=CHECK-NOLONGCALL %s
+// CHECK-NOLONGCALL: "-target-feature" "-longcall"
+
+// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-longcall -mlongcall 
-### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-LONGCALL %s
+// CHECK-LONGCALL: "-target-feature" "+longcall"
+
 // RUN: %clang -target powerpc64-unknown-linux-gnu %s 
-mno-invariant-function-descriptors -### -o %t.o 2>&1 | FileCheck 
-check-prefix=CHECK-NOINVFUNCDESC %s
 // CHECK-NOINVFUNCDESC: "-target-feature" "-invariant-function-descriptors"
 


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


[libcxx] r280037 - Fix PR28831 - Bad logic around CMAKE_OSX_SYSROOT and CMAKE_OSX_ARCHITECTURES.

2016-08-29 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Mon Aug 29 19:54:37 2016
New Revision: 280037

URL: http://llvm.org/viewvc/llvm-project?rev=280037=rev
Log:
Fix PR28831 - Bad logic around CMAKE_OSX_SYSROOT and CMAKE_OSX_ARCHITECTURES.

See https://llvm.org/bugs/show_bug.cgi?id=28831 for more information about
the changes.

Modified:
libcxx/trunk/lib/CMakeLists.txt

Modified: libcxx/trunk/lib/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/CMakeLists.txt?rev=280037=280036=280037=diff
==
--- libcxx/trunk/lib/CMakeLists.txt (original)
+++ libcxx/trunk/lib/CMakeLists.txt Mon Aug 29 19:54:37 2016
@@ -105,9 +105,9 @@ if ( APPLE AND (LIBCXX_CXX_ABI_LIBNAME S
   
"-Wl,-unexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++unexp.exp"
   "/usr/lib/libSystem.B.dylib")
   else()
-if ( ${CMAKE_OSX_SYSROOT} )
+if (DEFINED CMAKE_OSX_SYSROOT)
   list(FIND ${CMAKE_OSX_ARCHITECTURES} "armv7" OSX_HAS_ARMV7)
-  if (OSX_HAS_ARMV7)
+  if (NOT OSX_HAS_ARMV7 EQUAL -1)
 set(OSX_RE_EXPORT_LINE
   "${CMAKE_OSX_SYSROOT}/usr/lib/libc++abi.dylib"
   
"-Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++sjlj-abi.exp")


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


Re: [PATCH] D23765: Fix for clang PR 29087

2016-08-29 Thread Taewook Oh via cfe-commits
twoh added a comment.

ping


https://reviews.llvm.org/D23765



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


r280035 - C++ Modules TS: driver support for building modules.

2016-08-29 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Mon Aug 29 19:44:54 2016
New Revision: 280035

URL: http://llvm.org/viewvc/llvm-project?rev=280035=rev
Log:
C++ Modules TS: driver support for building modules.

This works as follows: we add --precompile to the existing gamut of options for
specifying how far to go when compiling an input (-E, -c, -S, etc.). This flag
specifies that an input is taken to the precompilation step and no further, and
this can be specified when building a .pcm from a module interface or when
building a .pch from a header file.

The .cppm extension (and some related extensions) are implicitly recognized as
C++ module interface files. If --precompile is /not/ specified, the file is
compiled (via a .pcm) to a .o file containing the code for the module (and then
potentially also assembled and linked, if -S, -c, etc. are not specified). We
do not yet suppress the emission of object code for other users of the module
interface, so for now this will only work if everything in the .cppm file has
vague linkage.

As with the existing support for module-map modules, prebuilt modules can be
provided as compiler inputs either via the -fmodule-file= command-line argument
or via files named ModuleName.pcm in one of the directories specified via
-fprebuilt-module-path=.

This also exposes the -fmodules-ts cc1 flag in the driver. This is still
experimental, and in particular, the concrete syntax is subject to change as
the Modules TS evolves in the C++ committee. Unlike -fmodules, this flag does
not enable support for implicitly loading module maps nor building modules via
the module cache, but those features can be turned on separately and used in
conjunction with the Modules TS support.

Added:
cfe/trunk/test/Driver/modules-ts.cpp
Modified:
cfe/trunk/include/clang/Driver/CC1Options.td
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/include/clang/Driver/Types.def
cfe/trunk/include/clang/Driver/Types.h
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Driver/Types.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/Parse/Parser.cpp
cfe/trunk/test/Driver/cl-pch.cpp

Modified: cfe/trunk/include/clang/Driver/CC1Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=280035=280034=280035=diff
==
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Mon Aug 29 19:44:54 2016
@@ -391,8 +391,6 @@ def ast_dump_filter : Separate<["-"], "a
   HelpText<"Use with -ast-dump or -ast-print to dump/print only AST 
declaration"
" nodes having a certain substring in a qualified name. Use"
" -ast-list to list all filterable declaration node names.">;
-def fmodules_ts : Flag <["-"], "fmodules-ts">, Group,
-  HelpText<"Enable support for the C++ Modules TS">;
 def fno_modules_global_index : Flag<["-"], "fno-modules-global-index">,
   HelpText<"Do not automatically generate or update the global module index">;
 def fno_modules_error_recovery : Flag<["-"], "fno-modules-error-recovery">,

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=280035=280034=280035=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Mon Aug 29 19:44:54 2016
@@ -874,6 +874,8 @@ def fmodules : Flag <["-"], "fmodules">,
 def fimplicit_module_maps : Flag <["-"], "fimplicit-module-maps">, 
Group,
   Flags<[DriverOption, CC1Option]>,
   HelpText<"Implicitly search the file system for module map files.">;
+def fmodules_ts : Flag <["-"], "fmodules-ts">, Group,
+  Flags<[CC1Option]>, HelpText<"Enable support for the C++ Modules TS">;
 def fmodule_maps : Flag <["-"], "fmodule-maps">, Alias;
 def fmodule_name_EQ : Joined<["-"], "fmodule-name=">, Group,
   Flags<[DriverOption,CC1Option]>, MetaVarName<"">,
@@ -2026,6 +2028,8 @@ def _output_EQ : Joined<["--"], "output=
 def _output : Separate<["--"], "output">, Alias;
 def _param : Separate<["--"], "param">, Group;
 def _param_EQ : Joined<["--"], "param=">, Alias<_param>;
+def _precompile : Flag<["--"], "precompile">, Flags<[DriverOption]>,
+  Group, HelpText<"Only precompile the input">;
 def _prefix_EQ : Joined<["--"], "prefix=">, Alias;
 def _prefix : Separate<["--"], "prefix">, Alias;
 def _preprocess : Flag<["--"], "preprocess">, Alias;

Modified: cfe/trunk/include/clang/Driver/Types.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Types.def?rev=280035=280034=280035=diff
==
--- cfe/trunk/include/clang/Driver/Types.def (original)
+++ cfe/trunk/include/clang/Driver/Types.def Mon Aug 29 19:44:54 2016
@@ -34,6 +34,7 @@
 //  a - 

Re: [PATCH] D23734: Add -fprofile-dir= to clang.

2016-08-29 Thread Saleem Abdulrasool via cfe-commits
compnerd added a subscriber: compnerd.


Comment at: lib/Transforms/Instrumentation/GCOVProfiling.cpp:121
@@ -120,2 +120,3 @@
 
-  std::string mangleName(const DICompileUnit *CU, const char *NewStem);
+  enum GCovFileType { GCNO, GCDA };
+  std::string mangleName(const DICompileUnit *CU, GCovFileType NewStem);

Might be nice to use `enum class`.


Comment at: lib/Transforms/Instrumentation/GCOVProfiling.cpp:422
@@ -420,3 +421,3 @@
 std::string GCOVProfiler::mangleName(const DICompileUnit *CU,
- const char *NewStem) {
+ GCovFileType NewStem) {
   if (NamedMDNode *GCov = M->getNamedMetadata("llvm.gcov")) {

I think that `NewStem` is no longer appropriate.


Comment at: lib/Transforms/Instrumentation/GCOVProfiling.cpp:447
@@ -432,3 +446,3 @@
 return Filename.str();
   }
 }

It really feels like these two cases can be collapsed.


Comment at: tools/clang/lib/CodeGen/CodeGenModule.cpp:4221
@@ +4220,3 @@
+  llvm::LLVMContext  = TheModule.getContext();
+  llvm::MDString *CoverageDataFile =
+  llvm::MDString::get(Ctx, getCodeGenOpts().CoverageDataFile);

`auto *CoverageDataFile` perhaps?


Comment at: tools/clang/lib/CodeGen/CodeGenModule.cpp:4223
@@ +4222,3 @@
+  llvm::MDString::get(Ctx, getCodeGenOpts().CoverageDataFile);
+  llvm::MDString *CoverageNotesFile =
+  llvm::MDString::get(Ctx, getCodeGenOpts().CoverageNotesFile);

Similar.


Comment at: tools/clang/lib/Driver/Tools.cpp:3621
@@ -3621,1 +3620,3 @@
+OutputFilename = llvm::sys::path::filename(Output.getBaseInput());
   }
+  SmallString<128> CoverageFilename = OutputFilename;

Unnecessary braces.


https://reviews.llvm.org/D23734



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


Re: [PATCH] D22766: Handle -mlong-calls on Hexagon

2016-08-29 Thread Saleem Abdulrasool via cfe-commits
compnerd accepted this revision.
compnerd added a reviewer: compnerd.
compnerd added a comment.
This revision is now accepted and ready to land.

That is a bug in the LLVM implementation.  The functionality is supported on 
other (i.e. `gcc`) compilers.


Repository:
  rL LLVM

https://reviews.llvm.org/D22766



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


Re: [PATCH] D23279: clang-reorder-fields

2016-08-29 Thread Alexander Shaposhnikov via cfe-commits
alexshap added a comment.

F2347517: pingu 


Repository:
  rL LLVM

https://reviews.llvm.org/D23279



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


Re: [PATCH] D24015: [CMake] Copy headers relative to LLVM_BINARY_DIR

2016-08-29 Thread Justin Bogner via cfe-commits
Chris Bieneman  writes:
> beanz created this revision.
> beanz added reviewers: bogner, EricWF.
> beanz added a subscriber: cfe-commits.
>
> This copy phase is only needed for in-tree builds, so we should be
> copying to the LLVM build directory's include dir instead of the
> sub-project include dir.

LGTM!

> https://reviews.llvm.org/D24015
>
> Files:
>   include/CMakeLists.txt
>
> Index: include/CMakeLists.txt
> ===
> --- include/CMakeLists.txt
> +++ include/CMakeLists.txt
> @@ -10,11 +10,13 @@
>${LIBCXX_SUPPORT_HEADER_PATTERN}
>)
>  
> -file(COPY .
> -  DESTINATION "${CMAKE_BINARY_DIR}/include/c++/v1"
> -  FILES_MATCHING
> -  ${LIBCXX_HEADER_PATTERN}
> -  )
> +if(LLVM_BINARY_DIR)
> +  file(COPY .
> +DESTINATION "${LLVM_BINARY_DIR}/include/c++/v1"
> +FILES_MATCHING
> +${LIBCXX_HEADER_PATTERN}
> +)
> +endif()
>  
>  if (LIBCXX_INSTALL_HEADERS)
>install(DIRECTORY .
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D24015: [CMake] Copy headers relative to LLVM_BINARY_DIR

2016-08-29 Thread Chris Bieneman via cfe-commits
beanz created this revision.
beanz added reviewers: bogner, EricWF.
beanz added a subscriber: cfe-commits.

This copy phase is only needed for in-tree builds, so we should be copying to 
the LLVM build directory's include dir instead of the sub-project include dir.

https://reviews.llvm.org/D24015

Files:
  include/CMakeLists.txt

Index: include/CMakeLists.txt
===
--- include/CMakeLists.txt
+++ include/CMakeLists.txt
@@ -10,11 +10,13 @@
   ${LIBCXX_SUPPORT_HEADER_PATTERN}
   )
 
-file(COPY .
-  DESTINATION "${CMAKE_BINARY_DIR}/include/c++/v1"
-  FILES_MATCHING
-  ${LIBCXX_HEADER_PATTERN}
-  )
+if(LLVM_BINARY_DIR)
+  file(COPY .
+DESTINATION "${LLVM_BINARY_DIR}/include/c++/v1"
+FILES_MATCHING
+${LIBCXX_HEADER_PATTERN}
+)
+endif()
 
 if (LIBCXX_INSTALL_HEADERS)
   install(DIRECTORY .


Index: include/CMakeLists.txt
===
--- include/CMakeLists.txt
+++ include/CMakeLists.txt
@@ -10,11 +10,13 @@
   ${LIBCXX_SUPPORT_HEADER_PATTERN}
   )
 
-file(COPY .
-  DESTINATION "${CMAKE_BINARY_DIR}/include/c++/v1"
-  FILES_MATCHING
-  ${LIBCXX_HEADER_PATTERN}
-  )
+if(LLVM_BINARY_DIR)
+  file(COPY .
+DESTINATION "${LLVM_BINARY_DIR}/include/c++/v1"
+FILES_MATCHING
+${LIBCXX_HEADER_PATTERN}
+)
+endif()
 
 if (LIBCXX_INSTALL_HEADERS)
   install(DIRECTORY .
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23895: [ms] Add support for parsing uuid as a MS attribute

2016-08-29 Thread Reid Kleckner via cfe-commits
rnk added a comment.

In https://reviews.llvm.org/D23895#528208, @aaron.ballman wrote:

> You are removing a lot of instances of `MaybeParseMicrosoftAttributes()`, but 
> I'm not certain I understand why. Can you describe why you need to remove 
> those?


That shouldn't change functionality, Nico wrote: "It moved calls of 
MaybeParseMicrosoftAttributes(attrs) that precede 
ParseExternalDeclaration(attrs) into ParseExternalDeclaration(). As far as I 
can tell, every call of ParseExternalDeclaration() was preceded by a call to 
MaybeParseMicrosoftAttributes(), so this should be behavior-preserving."



Comment at: include/clang/Sema/AttributeList.h:111
@@ -108,3 +110,3 @@
 /// #pragma ...
-AS_Pragma
+AS_Pragma,
   };

aaron.ballman wrote:
> Please remove the trailing comma.
IMO trailing commas in long lists are nice. There's a reason they got added to 
C++11.


https://reviews.llvm.org/D23895



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


r280031 - [cfi] Export __cfi_check when linking with -fsanitize-cfi-cross-dso.

2016-08-29 Thread Evgeniy Stepanov via cfe-commits
Author: eugenis
Date: Mon Aug 29 18:42:34 2016
New Revision: 280031

URL: http://llvm.org/viewvc/llvm-project?rev=280031=rev
Log:
[cfi] Export __cfi_check when linking with -fsanitize-cfi-cross-dso.

Multi-DSO CFI model requires every DSO to export a __cfi_check function.

Modified:
cfe/trunk/include/clang/Driver/SanitizerArgs.h
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/sanitizer-ld.c

Modified: cfe/trunk/include/clang/Driver/SanitizerArgs.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/SanitizerArgs.h?rev=280031=280030=280031=diff
==
--- cfe/trunk/include/clang/Driver/SanitizerArgs.h (original)
+++ cfe/trunk/include/clang/Driver/SanitizerArgs.h Mon Aug 29 18:42:34 2016
@@ -66,6 +66,7 @@ class SanitizerArgs {
   bool requiresPIE() const;
   bool needsUnwindTables() const;
   bool linkCXXRuntimes() const { return LinkCXXRuntimes; }
+  bool hasCrossDsoCfi() const { return CfiCrossDso; }
   void addArgs(const ToolChain , const llvm::opt::ArgList ,
llvm::opt::ArgStringList , types::ID InputType) const;
 };

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=280031=280030=280031=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Mon Aug 29 18:42:34 2016
@@ -3194,6 +3194,11 @@ static bool addSanitizerRuntimes(const T
   // to be dynamic to be sure we export sanitizer interface functions.
   if (AddExportDynamic)
 CmdArgs.push_back("-export-dynamic");
+
+  const SanitizerArgs  = TC.getSanitizerArgs();
+  if (SanArgs.hasCrossDsoCfi() && !AddExportDynamic)
+CmdArgs.push_back("-export-dynamic-symbol=__cfi_check");
+
   return !StaticRuntimes.empty();
 }
 

Modified: cfe/trunk/test/Driver/sanitizer-ld.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/sanitizer-ld.c?rev=280031=280030=280031=diff
==
--- cfe/trunk/test/Driver/sanitizer-ld.c (original)
+++ cfe/trunk/test/Driver/sanitizer-ld.c Mon Aug 29 18:42:34 2016
@@ -365,6 +365,7 @@
 // RUN:   | FileCheck --check-prefix=CHECK-CFI-CROSS-DSO-LINUX %s
 // CHECK-CFI-CROSS-DSO-LINUX: "{{.*}}ld{{(.exe)?}}"
 // CHECK-CFI-CROSS-DSO-LINUX: "-whole-archive" 
"{{[^"]*}}libclang_rt.cfi-x86_64.a" "-no-whole-archive"
+// CHECK-CFI-CROSS-DSO-LINUX: -export-dynamic
 
 // Cross-DSO CFI with diagnostics links just the CFI runtime.
 // RUN: %clang -fsanitize=cfi -fsanitize-cfi-cross-dso %s -### -o %t.o 2>&1 \
@@ -374,6 +375,7 @@
 // RUN:   | FileCheck --check-prefix=CHECK-CFI-CROSS-DSO-DIAG-LINUX %s
 // CHECK-CFI-CROSS-DSO-DIAG-LINUX: "{{.*}}ld{{(.exe)?}}"
 // CHECK-CFI-CROSS-DSO-DIAG-LINUX: "-whole-archive" 
"{{[^"]*}}libclang_rt.cfi_diag-x86_64.a" "-no-whole-archive"
+// CHECK-CFI-CROSS-DSO-DIAG-LINUX: -export-dynamic
 
 // RUN: %clangxx -fsanitize=address %s -### -o %t.o 2>&1 \
 // RUN: -mmacosx-version-min=10.6 \
@@ -452,6 +454,26 @@
 // CHECK-SAFESTACK-ANDROID-AARCH64: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
 // CHECK-SAFESTACK-ANDROID-AARCH64-NOT: libclang_rt.safestack
 
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target arm-linux-androideabi -fsanitize=cfi \
+// RUN: --sysroot=%S/Inputs/basic_android_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-CFI-ANDROID %s
+//
+// CHECK-CFI-ANDROID: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
+// CHECK-CFI-ANDROID-NOT: libclang_rt.cfi
+// CHECK-CFI-ANDROID-NOT: __cfi_check
+
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -target arm-linux-androideabi -fsanitize=cfi \
+// RUN: -fsanitize-cfi-cross-dso \
+// RUN: --sysroot=%S/Inputs/basic_android_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-CROSSDSO-CFI-ANDROID %s
+//
+// CHECK-CROSSDSO-CFI-ANDROID: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
+// CHECK-CROSSDSO-CFI-ANDROID-NOT: libclang_rt.cfi
+// CHECK-CROSSDSO-CFI-ANDROID: -export-dynamic-symbol=__cfi_check
+// CHECK-CROSSDSO-CFI-ANDROID-NOT: libclang_rt.cfi
+
 // RUN: %clang -fsanitize=undefined %s -### -o %t.o 2>&1 \
 // RUN: -target x86_64-scei-ps4 \
 // RUN: -shared \


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


r280028 - Fix typo in test.

2016-08-29 Thread Evgeniy Stepanov via cfe-commits
Author: eugenis
Date: Mon Aug 29 18:15:46 2016
New Revision: 280028

URL: http://llvm.org/viewvc/llvm-project?rev=280028=rev
Log:
Fix typo in test.

Modified:
cfe/trunk/test/Driver/sanitizer-ld.c

Modified: cfe/trunk/test/Driver/sanitizer-ld.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/sanitizer-ld.c?rev=280028=280027=280028=diff
==
--- cfe/trunk/test/Driver/sanitizer-ld.c (original)
+++ cfe/trunk/test/Driver/sanitizer-ld.c Mon Aug 29 18:15:46 2016
@@ -439,7 +439,7 @@
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o -shared 2>&1 \
 // RUN: -target arm-linux-androideabi -fsanitize=safe-stack \
 // RUN: --sysroot=%S/Inputs/basic_android_tree \
-// RUN:   | FileCheck --check-prefix=CHECK-SAFESTACK-ANDROID-ARM %s
+// RUN:   | FileCheck --check-prefix=CHECK-SAFESTACK-SHARED-ANDROID-ARM %s
 //
 // CHECK-SAFESTACK-SHARED-ANDROID-ARM: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
 // CHECK-SAFESTACK-SHARED-ANDROID-ARM-NOT: libclang_rt.safestack


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


[PATCH] D24012: Fix strict-aliasing violation in typeinfo::hash_code()

2016-08-29 Thread Eric Fiselier via cfe-commits
EricWF created this revision.
EricWF added reviewers: mclow.lists, howard.hinnant.
EricWF added a subscriber: cfe-commits.

The current implementation of `hash_code()` for uniqued RTTI strings violates 
strict aliasing by dereferencing a type-punned pointer. Specifically it 
generates a `const char**` pointer from the address of the `__name` member 
before casting it to `const size_t*` and dereferencing it to get the hash. This 
is really just a complex and incorrect way of writing 
`reinterpret_cast(__name)`.

This patch changes the conversion sequence so that it no longer contains UB.


https://reviews.llvm.org/D24012

Files:
  include/__config
  include/typeinfo

Index: include/typeinfo
===
--- include/typeinfo
+++ include/typeinfo
@@ -74,8 +74,6 @@
 type_info& operator=(const type_info&);
 type_info(const type_info&);
 
-typedef size_t _LIBCPP_MAY_ALIAS _ASizeT; // Avoid strict-aliasing issues.
-
 protected:
 #ifndef _LIBCPP_NONUNIQUE_RTTI_BIT
 const char* __type_name;
@@ -116,7 +114,7 @@
 _LIBCPP_INLINE_VISIBILITY
 size_t hash_code() const _NOEXCEPT
 #ifndef _LIBCPP_NONUNIQUE_RTTI_BIT
-{return *reinterpret_cast(&__type_name);}
+{return reinterpret_cast(__type_name);}
 #else
 {if (!(__type_name & _LIBCPP_NONUNIQUE_RTTI_BIT)) return __type_name;
  const char *__ptr = name();
Index: include/__config
===
--- include/__config
+++ include/__config
@@ -691,12 +691,6 @@
 #define _NOALIAS
 #endif
 
-#ifdef __GNUC__
-#define _LIBCPP_MAY_ALIAS __attribute__((__may_alias__))
-#else
-#define _LIBCPP_MAY_ALIAS
-#endif
-
 #if __has_feature(cxx_explicit_conversions) || defined(__IBMCPP__)
 #   define _LIBCPP_EXPLICIT explicit
 #else


Index: include/typeinfo
===
--- include/typeinfo
+++ include/typeinfo
@@ -74,8 +74,6 @@
 type_info& operator=(const type_info&);
 type_info(const type_info&);
 
-typedef size_t _LIBCPP_MAY_ALIAS _ASizeT; // Avoid strict-aliasing issues.
-
 protected:
 #ifndef _LIBCPP_NONUNIQUE_RTTI_BIT
 const char* __type_name;
@@ -116,7 +114,7 @@
 _LIBCPP_INLINE_VISIBILITY
 size_t hash_code() const _NOEXCEPT
 #ifndef _LIBCPP_NONUNIQUE_RTTI_BIT
-{return *reinterpret_cast(&__type_name);}
+{return reinterpret_cast(__type_name);}
 #else
 {if (!(__type_name & _LIBCPP_NONUNIQUE_RTTI_BIT)) return __type_name;
  const char *__ptr = name();
Index: include/__config
===
--- include/__config
+++ include/__config
@@ -691,12 +691,6 @@
 #define _NOALIAS
 #endif
 
-#ifdef __GNUC__
-#define _LIBCPP_MAY_ALIAS __attribute__((__may_alias__))
-#else
-#define _LIBCPP_MAY_ALIAS
-#endif
-
 #if __has_feature(cxx_explicit_conversions) || defined(__IBMCPP__)
 #   define _LIBCPP_EXPLICIT explicit
 #else
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23944: Parsing MS pragma intrinsic

2016-08-29 Thread Albert Gutowski via cfe-commits
agutowski marked 4 inline comments as done.
agutowski added a comment.

https://reviews.llvm.org/D23944



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


Re: [PATCH] D23944: Parsing MS pragma intrinsic

2016-08-29 Thread Albert Gutowski via cfe-commits
agutowski updated this revision to Diff 69632.
agutowski added a comment.

Changed warning template to use select, fixed some mistakes in the comments.


https://reviews.llvm.org/D23944

Files:
  include/clang/Basic/DiagnosticParseKinds.td
  include/clang/Parse/Parser.h
  lib/Parse/ParsePragma.cpp
  test/Preprocessor/pragma_microsoft.c

Index: lib/Parse/ParsePragma.cpp
===
--- lib/Parse/ParsePragma.cpp
+++ lib/Parse/ParsePragma.cpp
@@ -161,6 +161,12 @@
   PragmaMSRuntimeChecksHandler() : EmptyPragmaHandler("runtime_checks") {}
 };
 
+struct PragmaMSIntrinsicHandler : public PragmaHandler {
+  PragmaMSIntrinsicHandler() : PragmaHandler("intrinsic") {}
+  void HandlePragma(Preprocessor , PragmaIntroducerKind Introducer,
+Token ) override;
+};
+
 }  // end namespace
 
 void Parser::initializePragmaHandlers() {
@@ -229,6 +235,8 @@
 PP.AddPragmaHandler(MSSection.get());
 MSRuntimeChecks.reset(new PragmaMSRuntimeChecksHandler());
 PP.AddPragmaHandler(MSRuntimeChecks.get());
+MSIntrinsic.reset(new PragmaMSIntrinsicHandler());
+PP.AddPragmaHandler(MSIntrinsic.get());
   }
 
   OptimizeHandler.reset(new PragmaOptimizeHandler(Actions));
@@ -297,6 +305,8 @@
 MSSection.reset();
 PP.RemovePragmaHandler(MSRuntimeChecks.get());
 MSRuntimeChecks.reset();
+PP.RemovePragmaHandler(MSIntrinsic.get());
+MSIntrinsic.reset();
   }
 
   PP.RemovePragmaHandler("STDC", FPContractHandler.get());
@@ -2127,3 +2137,53 @@
   PP.EnterTokenStream(std::move(TokenArray), 1,
   /*DisableMacroExpansion=*/false);
 }
+
+/// \brief Handle the Microsoft \#pragma intrinsic extension.
+///
+/// The syntax is:
+/// \code
+///  #pragma intrinsic(memset)
+///  #pragma intrinsic(strlen, memcpy)
+/// \endcode
+///
+/// Pragma intrisic tells the compiler to use a builtin version of the
+/// function. Clang does it anyway, so the pragma doesn't really do anything.
+/// Anyway, we emit a warning if the function specified in \#pragma intrinsic
+/// isn't an intrinsic in clang and suggest to include intrin.h.
+void PragmaMSIntrinsicHandler::HandlePragma(Preprocessor ,
+PragmaIntroducerKind Introducer,
+Token ) {
+  PP.Lex(Tok);
+
+  if (Tok.isNot(tok::l_paren)) {
+PP.Diag(Tok.getLocation(), diag::warn_pragma_expected_lparen)
+<< "intrinsic";
+return;
+  }
+  PP.Lex(Tok);
+
+  bool SuggestIntrinH = !PP.isMacroDefined("__INTRIN_H");
+
+  while (Tok.is(tok::identifier)) {
+IdentifierInfo *II = Tok.getIdentifierInfo();
+if (II->getBuiltinID() < 2)
+  PP.Diag(Tok.getLocation(), diag::warn_pragma_intrinsic_builtin)
+  << II << SuggestIntrinH;
+
+PP.Lex(Tok);
+if (Tok.isNot(tok::comma))
+  break;
+PP.Lex(Tok);
+  }
+
+  if (Tok.isNot(tok::r_paren)) {
+PP.Diag(Tok.getLocation(), diag::warn_pragma_expected_rparen)
+<< "intrinsic";
+return;
+  }
+  PP.Lex(Tok);
+
+  if (Tok.isNot(tok::eod))
+PP.Diag(Tok.getLocation(), diag::warn_pragma_extra_tokens_at_eol)
+<< "intrinsic";
+}
Index: include/clang/Parse/Parser.h
===
--- include/clang/Parse/Parser.h
+++ include/clang/Parse/Parser.h
@@ -172,6 +172,7 @@
   std::unique_ptr MSCodeSeg;
   std::unique_ptr MSSection;
   std::unique_ptr MSRuntimeChecks;
+  std::unique_ptr MSIntrinsic;
   std::unique_ptr OptimizeHandler;
   std::unique_ptr LoopHintHandler;
   std::unique_ptr UnrollHintHandler;
Index: include/clang/Basic/DiagnosticParseKinds.td
===
--- include/clang/Basic/DiagnosticParseKinds.td
+++ include/clang/Basic/DiagnosticParseKinds.td
@@ -911,6 +911,10 @@
 def warn_pragma_pack_malformed : Warning<
   "expected integer or identifier in '#pragma pack' - ignored">,
   InGroup;
+// - #pragma intrinsic
+def warn_pragma_intrinsic_builtin : Warning<
+  "%0 is not a recognized builtin%select{|; consider including  to access non-builtin intrinsics}1">,
+  InGroup;
 // - #pragma unused
 def warn_pragma_unused_expected_var : Warning<
   "expected '#pragma unused' argument to be a variable name">,
Index: test/Preprocessor/pragma_microsoft.c
===
--- test/Preprocessor/pragma_microsoft.c
+++ test/Preprocessor/pragma_microsoft.c
@@ -162,3 +162,19 @@
 
 // Test that runtime_checks is parsed but ignored.
 #pragma runtime_checks("sc", restore) // no-warning
+
+// Test pragma intrinsic
+#pragma intrinsic(memset) // no-warning
+#pragma intrinsic(memcpy, strlen, strlen) // no-warning
+#pragma intrinsic() // no-warning
+#pragma intrinsic(asdf) // expected-warning {{'asdf' is not a recognized builtin; consider including }}
+#pragma intrinsic(main) // expected-warning {{'main' is not a recognized builtin; consider including }}
+#pragma intrinsic( // 

[PATCH] D24010: [ReachableCode] Skip over ExprWithCleanups in isConfigurationValue

2016-08-29 Thread Tim Shen via cfe-commits
timshen created this revision.
timshen added reviewers: rsmith, pirama.
timshen added a subscriber: cfe-commits.

https://reviews.llvm.org/D24010

Files:
  clang/include/clang/AST/Stmt.h
  clang/lib/Analysis/ReachableCode.cpp
  clang/test/SemaCXX/PR29152.cpp

Index: clang/test/SemaCXX/PR29152.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/PR29152.cpp
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -fsyntax-only -Wunreachable-code -verify %s
+
+static const bool False = false;
+
+struct Vector {
+  struct iterator {
+bool operator==(const iterator &) const;
+  };
+  iterator end();
+};
+
+void Bar();
+Vector::iterator Find(Vector );
+
+void Foo(Vector ) {
+  if (False && Find(a) == a.end()) {
+Bar(); // expected-no-diagnostics
+  }
+}
Index: clang/lib/Analysis/ReachableCode.cpp
===
--- clang/lib/Analysis/ReachableCode.cpp
+++ clang/lib/Analysis/ReachableCode.cpp
@@ -164,6 +164,8 @@
   if (!S)
 return false;
 
+  S = S->IgnoreImplicit();
+
   if (const Expr *Ex = dyn_cast(S))
 S = Ex->IgnoreCasts();
 
Index: clang/include/clang/AST/Stmt.h
===
--- clang/include/clang/AST/Stmt.h
+++ clang/include/clang/AST/Stmt.h
@@ -387,6 +387,9 @@
   /// Skip past any implicit AST nodes which might surround this
   /// statement, such as ExprWithCleanups or ImplicitCastExpr nodes.
   Stmt *IgnoreImplicit();
+  const Stmt *IgnoreImplicit() const {
+return const_cast(this)->IgnoreImplicit();
+  }
 
   /// \brief Skip no-op (attributed, compound) container stmts and skip 
captured
   /// stmt at the top, if \a IgnoreCaptured is true.


Index: clang/test/SemaCXX/PR29152.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/PR29152.cpp
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -fsyntax-only -Wunreachable-code -verify %s
+
+static const bool False = false;
+
+struct Vector {
+  struct iterator {
+bool operator==(const iterator &) const;
+  };
+  iterator end();
+};
+
+void Bar();
+Vector::iterator Find(Vector );
+
+void Foo(Vector ) {
+  if (False && Find(a) == a.end()) {
+Bar(); // expected-no-diagnostics
+  }
+}
Index: clang/lib/Analysis/ReachableCode.cpp
===
--- clang/lib/Analysis/ReachableCode.cpp
+++ clang/lib/Analysis/ReachableCode.cpp
@@ -164,6 +164,8 @@
   if (!S)
 return false;
 
+  S = S->IgnoreImplicit();
+
   if (const Expr *Ex = dyn_cast(S))
 S = Ex->IgnoreCasts();
 
Index: clang/include/clang/AST/Stmt.h
===
--- clang/include/clang/AST/Stmt.h
+++ clang/include/clang/AST/Stmt.h
@@ -387,6 +387,9 @@
   /// Skip past any implicit AST nodes which might surround this
   /// statement, such as ExprWithCleanups or ImplicitCastExpr nodes.
   Stmt *IgnoreImplicit();
+  const Stmt *IgnoreImplicit() const {
+return const_cast(this)->IgnoreImplicit();
+  }
 
   /// \brief Skip no-op (attributed, compound) container stmts and skip captured
   /// stmt at the top, if \a IgnoreCaptured is true.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxxabi] r280023 - [CMake] Trying to fix the bots I broke

2016-08-29 Thread Chris Bieneman via cfe-commits
Author: cbieneman
Date: Mon Aug 29 17:26:00 2016
New Revision: 280023

URL: http://llvm.org/viewvc/llvm-project?rev=280023=rev
Log:
[CMake] Trying to fix the bots I broke

See: 
http://lab.llvm.org:8011/builders/libcxx-libcxxabi-x86_64-linux-ubuntu-cxx1z/builds/981/steps/build.libcxxabi/logs/stdio

Modified:
libcxxabi/trunk/cmake/config-ix.cmake

Modified: libcxxabi/trunk/cmake/config-ix.cmake
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/cmake/config-ix.cmake?rev=280023=280022=280023=diff
==
--- libcxxabi/trunk/cmake/config-ix.cmake (original)
+++ libcxxabi/trunk/cmake/config-ix.cmake Mon Aug 29 17:26:00 2016
@@ -40,7 +40,7 @@ check_cxx_compiler_flag(/GR-
 check_cxx_compiler_flag(-std=c++11LIBCXXABI_HAS_STD_CXX11)
 
 if(LIBCXXABI_HAS_STD_CXX11)
-  list(APPEND CMAKE_CXX_FLAGS -std=c++11)
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
 endif()
 
 # Check libraries


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


Re: [PATCH] D23944: Parsing MS pragma intrinsic

2016-08-29 Thread Albert Gutowski via cfe-commits
agutowski added inline comments.


Comment at: lib/Parse/ParsePragma.cpp:2164
@@ +2163,3 @@
+
+  bool SuggestIntrinH = !PP.isMacroDefined("__INTRIN_H");
+

aaron.ballman wrote:
> Is this safe to rely on? I'm not familiar with how we do our intrinsics, but 
> it's spelled `__INTRIN_H_` in MSVC 2015, but perhaps we only care about 
> intrin.h from Clang?
I guess we only care about intrin.h from Clang - as far as I can see, MSVC's 
intrin.h contains only declarations, so including it won't change anything most 
of the time if the intrinsic isn't implemented in Clang.


https://reviews.llvm.org/D23944



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


Re: [PATCH] D24007: [CMake] Use -std=c++11 if supported

2016-08-29 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL280021: [CMake] Use -std=c++11 if supported (authored by 
cbieneman).

Changed prior to commit:
  https://reviews.llvm.org/D24007?vs=69619=69624#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D24007

Files:
  libcxxabi/trunk/cmake/config-ix.cmake

Index: libcxxabi/trunk/cmake/config-ix.cmake
===
--- libcxxabi/trunk/cmake/config-ix.cmake
+++ libcxxabi/trunk/cmake/config-ix.cmake
@@ -37,6 +37,11 @@
 check_cxx_compiler_flag(/EHs- LIBCXXABI_HAS_NO_EHS_FLAG)
 check_cxx_compiler_flag(/EHa- LIBCXXABI_HAS_NO_EHA_FLAG)
 check_cxx_compiler_flag(/GR-  LIBCXXABI_HAS_NO_GR_FLAG)
+check_cxx_compiler_flag(-std=c++11LIBCXXABI_HAS_STD_CXX11)
+
+if(LIBCXXABI_HAS_STD_CXX11)
+  list(APPEND CMAKE_CXX_FLAGS -std=c++11)
+endif()
 
 # Check libraries
 check_library_exists(c fopen "" LIBCXXABI_HAS_C_LIB)


Index: libcxxabi/trunk/cmake/config-ix.cmake
===
--- libcxxabi/trunk/cmake/config-ix.cmake
+++ libcxxabi/trunk/cmake/config-ix.cmake
@@ -37,6 +37,11 @@
 check_cxx_compiler_flag(/EHs- LIBCXXABI_HAS_NO_EHS_FLAG)
 check_cxx_compiler_flag(/EHa- LIBCXXABI_HAS_NO_EHA_FLAG)
 check_cxx_compiler_flag(/GR-  LIBCXXABI_HAS_NO_GR_FLAG)
+check_cxx_compiler_flag(-std=c++11LIBCXXABI_HAS_STD_CXX11)
+
+if(LIBCXXABI_HAS_STD_CXX11)
+  list(APPEND CMAKE_CXX_FLAGS -std=c++11)
+endif()
 
 # Check libraries
 check_library_exists(c fopen "" LIBCXXABI_HAS_C_LIB)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxxabi] r280021 - [CMake] Use -std=c++11 if supported

2016-08-29 Thread Chris Bieneman via cfe-commits
Author: cbieneman
Date: Mon Aug 29 17:12:21 2016
New Revision: 280021

URL: http://llvm.org/viewvc/llvm-project?rev=280021=rev
Log:
[CMake] Use -std=c++11 if supported

Summary: This patch adds a check for if -std=c++11 is a supported flag, and 
adds it to CMAKE_CXX_FLAGS if it is supported.

Reviewers: EricWF

Subscribers: cfe-commits

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

Modified:
libcxxabi/trunk/cmake/config-ix.cmake

Modified: libcxxabi/trunk/cmake/config-ix.cmake
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/cmake/config-ix.cmake?rev=280021=280020=280021=diff
==
--- libcxxabi/trunk/cmake/config-ix.cmake (original)
+++ libcxxabi/trunk/cmake/config-ix.cmake Mon Aug 29 17:12:21 2016
@@ -37,6 +37,11 @@ check_cxx_compiler_flag(/EHsc
 check_cxx_compiler_flag(/EHs- LIBCXXABI_HAS_NO_EHS_FLAG)
 check_cxx_compiler_flag(/EHa- LIBCXXABI_HAS_NO_EHA_FLAG)
 check_cxx_compiler_flag(/GR-  LIBCXXABI_HAS_NO_GR_FLAG)
+check_cxx_compiler_flag(-std=c++11LIBCXXABI_HAS_STD_CXX11)
+
+if(LIBCXXABI_HAS_STD_CXX11)
+  list(APPEND CMAKE_CXX_FLAGS -std=c++11)
+endif()
 
 # Check libraries
 check_library_exists(c fopen "" LIBCXXABI_HAS_C_LIB)


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


Re: [PATCH] D24007: [CMake] Use -std=c++11 if supported

2016-08-29 Thread Eric Fiselier via cfe-commits
EricWF accepted this revision.
EricWF added a comment.
This revision is now accepted and ready to land.

LGTM. I'm surprised we don't already require C++11.



Comment at: cmake/config-ix.cmake:40
@@ -39,1 +39,3 @@
 check_cxx_compiler_flag(/GR-  LIBCXXABI_HAS_NO_GR_FLAG)
+check_cxx_compiler_flag(-std=c++11LIBCXXABI_HAS_CXX11)
+

Nit `LIBCXXABI_HAS_STD_CXX11`.


https://reviews.llvm.org/D24007



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


[PATCH] D24005: [compiler-rt cmake] Support overriding llvm-config query results

2016-08-29 Thread Michał Górny via cfe-commits
mgorny created this revision.
mgorny added reviewers: samsonov, Hahnfeld.
mgorny added a subscriber: cfe-commits.
Herald added a subscriber: dberris.

Support overriding LLVM_* variables obtained from llvm-config when doing 
stand-alone builds. The override of LLVM_MAIN_SRC_DIR is necessary to provide 
LLVM sources when the initial directory used to build LLVM does
no longer exist when compiler-rt is built stand-alone. This is especially the 
case when building the projects separately in temporary directories with 
unpredictable names.

The code is based on existing CMakeLists.txt from clang. Alike clang, it 
extends the override to all queried variables.


https://reviews.llvm.org/D24005

Files:
  cmake/Modules/CompilerRTUtils.cmake

Index: cmake/Modules/CompilerRTUtils.cmake
===
--- cmake/Modules/CompilerRTUtils.cmake
+++ cmake/Modules/CompilerRTUtils.cmake
@@ -197,10 +197,15 @@
 message(FATAL_ERROR "llvm-config failed with status ${HAD_ERROR}")
   endif()
   string(REGEX REPLACE "[ \t]*[\r\n]+[ \t]*" ";" CONFIG_OUTPUT 
${CONFIG_OUTPUT})
-  list(GET CONFIG_OUTPUT 0 LLVM_BINARY_DIR)
-  list(GET CONFIG_OUTPUT 1 LLVM_TOOLS_BINARY_DIR)
-  list(GET CONFIG_OUTPUT 2 LLVM_LIBRARY_DIR)
-  list(GET CONFIG_OUTPUT 3 LLVM_MAIN_SRC_DIR)
+  list(GET CONFIG_OUTPUT 0 LLVM_OBJ_ROOT)
+  list(GET CONFIG_OUTPUT 1 TOOLS_BINARY_DIR)
+  list(GET CONFIG_OUTPUT 2 LIBRARY_DIR)
+  list(GET CONFIG_OUTPUT 3 MAIN_SRC_DIR)
+
+  set(LLVM_BINARY_DIR ${LLVM_OBJ_ROOT} CACHE PATH "Path to LLVM build tree")
+  set(LLVM_TOOLS_BINARY_DIR ${TOOLS_BINARY_DIR} CACHE PATH "Path to llvm/bin")
+  set(LLVM_LIBRARY_DIR ${LIBRARY_DIR} CACHE PATH "Path to llvm/lib")
+  set(LLVM_MAIN_SRC_DIR ${MAIN_SRC_DIR} CACHE PATH "Path to LLVM source tree")
 
   # Make use of LLVM CMake modules.
   file(TO_CMAKE_PATH ${LLVM_BINARY_DIR} LLVM_BINARY_DIR_CMAKE_STYLE)


Index: cmake/Modules/CompilerRTUtils.cmake
===
--- cmake/Modules/CompilerRTUtils.cmake
+++ cmake/Modules/CompilerRTUtils.cmake
@@ -197,10 +197,15 @@
 message(FATAL_ERROR "llvm-config failed with status ${HAD_ERROR}")
   endif()
   string(REGEX REPLACE "[ \t]*[\r\n]+[ \t]*" ";" CONFIG_OUTPUT ${CONFIG_OUTPUT})
-  list(GET CONFIG_OUTPUT 0 LLVM_BINARY_DIR)
-  list(GET CONFIG_OUTPUT 1 LLVM_TOOLS_BINARY_DIR)
-  list(GET CONFIG_OUTPUT 2 LLVM_LIBRARY_DIR)
-  list(GET CONFIG_OUTPUT 3 LLVM_MAIN_SRC_DIR)
+  list(GET CONFIG_OUTPUT 0 LLVM_OBJ_ROOT)
+  list(GET CONFIG_OUTPUT 1 TOOLS_BINARY_DIR)
+  list(GET CONFIG_OUTPUT 2 LIBRARY_DIR)
+  list(GET CONFIG_OUTPUT 3 MAIN_SRC_DIR)
+
+  set(LLVM_BINARY_DIR ${LLVM_OBJ_ROOT} CACHE PATH "Path to LLVM build tree")
+  set(LLVM_TOOLS_BINARY_DIR ${TOOLS_BINARY_DIR} CACHE PATH "Path to llvm/bin")
+  set(LLVM_LIBRARY_DIR ${LIBRARY_DIR} CACHE PATH "Path to llvm/lib")
+  set(LLVM_MAIN_SRC_DIR ${MAIN_SRC_DIR} CACHE PATH "Path to LLVM source tree")
 
   # Make use of LLVM CMake modules.
   file(TO_CMAKE_PATH ${LLVM_BINARY_DIR} LLVM_BINARY_DIR_CMAKE_STYLE)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23856: [libc++] Perform configuration checks with -nodefaultlibs

2016-08-29 Thread Saleem Abdulrasool via cfe-commits
compnerd closed this revision.
compnerd added a comment.

SVN r280015


https://reviews.llvm.org/D23856



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


[libcxx] r280015 - libc++: perform configuration checks with -nodefaultlibs

2016-08-29 Thread Saleem Abdulrasool via cfe-commits
Author: compnerd
Date: Mon Aug 29 16:33:37 2016
New Revision: 280015

URL: http://llvm.org/viewvc/llvm-project?rev=280015=rev
Log:
libc++: perform configuration checks with -nodefaultlibs

We're compiling libc++ with -nodefaultlibs, so we should also pass this
option during the configuration checks to ensure those checks are
consistent with the actual build.

The primary motivation here is to ease cross-compilation against a
non-standard set of C++ libraries. Previously, the configuration checks
would attempt to link against the standard C++ libraries, which would
cause link failures when cross-compiling, even though the actual library
link would go through correctly (because of the use of -nodefaultlibs
and explicitly specifying any needed libraries). This is more correct
even ignoring the motivation, however.

Patch by Shoaib Meenai!

Modified:
libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake
libcxx/trunk/cmake/config-ix.cmake

Modified: libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake?rev=280015=280014=280015=diff
==
--- libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake (original)
+++ libcxx/trunk/cmake/Modules/CheckLibcxxAtomic.cmake Mon Aug 29 16:33:37 2016
@@ -9,10 +9,13 @@ INCLUDE(CheckCXXSourceCompiles)
 
 function(check_cxx_atomics varname)
   set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
-  set(CMAKE_REQUIRED_FLAGS "-std=c++11 -nostdinc++ -isystem 
${LIBCXX_SOURCE_DIR}/include")
+  set(CMAKE_REQUIRED_FLAGS "-nodefaultlibs -std=c++11 -nostdinc++ -isystem 
${LIBCXX_SOURCE_DIR}/include")
   if (${LIBCXX_GCC_TOOLCHAIN})
 set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} 
--gcc-toolchain=${LIBCXX_GCC_TOOLCHAIN}")
   endif()
+  if (CMAKE_C_FLAGS MATCHES -fsanitize OR CMAKE_CXX_FLAGS MATCHES -fsanitize)
+set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fno-sanitize=all")
+  endif()
   check_cxx_source_compiles("
 #include 
 #include 

Modified: libcxx/trunk/cmake/config-ix.cmake
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/config-ix.cmake?rev=280015=280014=280015=diff
==
--- libcxx/trunk/cmake/config-ix.cmake (original)
+++ libcxx/trunk/cmake/config-ix.cmake Mon Aug 29 16:33:37 2016
@@ -1,5 +1,34 @@
 include(CheckLibraryExists)
 include(CheckCXXCompilerFlag)
+
+check_library_exists(c fopen "" LIBCXX_HAS_C_LIB)
+if (NOT LIBCXX_USE_COMPILER_RT)
+  check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB)
+endif()
+
+# libc++ is built with -nodefaultlibs, so we want all our checks to also
+# use this option, otherwise we may end up with an inconsistency between
+# the flags we think we require during configuration (if the checks are
+# performed without -nodefaultlibs) and the flags that are actually
+# required during compilation (which has the -nodefaultlibs). libc is
+# required for the link to go through. We remove sanitizers from the
+# configuration checks to avoid spurious link errors.
+check_cxx_compiler_flag(-nodefaultlibs LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG)
+if (LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG)
+  set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nodefaultlibs")
+  if (LIBCXX_HAS_C_LIB)
+list(APPEND CMAKE_REQUIRED_LIBRARIES c)
+  endif ()
+  if (LIBCXX_USE_COMPILER_RT)
+list(APPEND CMAKE_REQUIRED_LIBRARIES -rtlib=compiler-rt)
+  elseif (LIBCXX_HAS_GCC_S_LIB)
+list(APPEND CMAKE_REQUIRED_LIBRARIES gcc_s)
+  endif ()
+  if (CMAKE_C_FLAGS MATCHES -fsanitize OR CMAKE_CXX_FLAGS MATCHES -fsanitize)
+set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fno-sanitize=all")
+  endif ()
+endif ()
+
 include(CheckLibcxxAtomic)
 
 # Check compiler flags
@@ -14,9 +43,5 @@ check_cxx_compiler_flag(/GR-
 
 # Check libraries
 check_library_exists(pthread pthread_create "" LIBCXX_HAS_PTHREAD_LIB)
-check_library_exists(c fopen "" LIBCXX_HAS_C_LIB)
 check_library_exists(m ccos "" LIBCXX_HAS_M_LIB)
 check_library_exists(rt clock_gettime "" LIBCXX_HAS_RT_LIB)
-if (NOT LIBCXX_USE_COMPILER_RT)
-  check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB)
-endif()


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


Re: [PATCH] D23944: Parsing MS pragma intrinsic

2016-08-29 Thread Aaron Ballman via cfe-commits
aaron.ballman added a subscriber: aaron.ballman.
aaron.ballman added a reviewer: aaron.ballman.


Comment at: include/clang/Basic/DiagnosticParseKinds.td:918
@@ +917,3 @@
+  InGroup;
+def warn_pragma_intrinsic_builtin_suggest : Warning<
+  "%0 is not a recognized builtin; consider including  to access 
non-builtin intrinsics">,

I would combine this with the above and use %select to decide whether to 
include the "consider including" bit. aka, `"%0 is not a recognized 
builtin%select{|; consider including  to access non-builtin 
intrinsics"}1"`.


Comment at: lib/Parse/ParsePragma.cpp:2148
@@ +2147,3 @@
+///
+/// Pragma intrisic tells compiler to use a builtin version of function.
+/// Clang does it anyway, so the pragma doesn't really do anything.

* tells the compiler
* of the function


Comment at: lib/Parse/ParsePragma.cpp:2150
@@ +2149,3 @@
+/// Clang does it anyway, so the pragma doesn't really do anything.
+/// Anyway, we emit a warning if the function specified in pragma intrinsic
+/// isn't an intrinsic in clang and suggest to include intrin.h.

pragma -> #pragma


Comment at: lib/Parse/ParsePragma.cpp:2157
@@ +2156,3 @@
+
+  if (Tok.isNot(tok::l_paren)) {
+PP.Diag(Tok.getLocation(), diag::warn_pragma_expected_lparen)

Not for your patch, but I wish we could use the balanced delimiter tracker for 
parsing pragmas.


Comment at: lib/Parse/ParsePragma.cpp:2164
@@ +2163,3 @@
+
+  bool SuggestIntrinH = !PP.isMacroDefined("__INTRIN_H");
+

Is this safe to rely on? I'm not familiar with how we do our intrinsics, but 
it's spelled `__INTRIN_H_` in MSVC 2015, but perhaps we only care about 
intrin.h from Clang?


Comment at: lib/Parse/ParsePragma.cpp:2169-2174
@@ +2168,8 @@
+if (II->getBuiltinID() < 2) {
+  if (SuggestIntrinH) {
+PP.Diag(Tok.getLocation(), diag::warn_pragma_intrinsic_builtin_suggest)
+<< II;
+  } else {
+PP.Diag(Tok.getLocation(), diag::warn_pragma_intrinsic_builtin) << II;
+  }
+}

Should elide braces here.


https://reviews.llvm.org/D23944



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


Re: [PATCH] D23734: Add -fprofile-dir= to clang.

2016-08-29 Thread Nick Lewycky via cfe-commits
nlewycky added a comment.

Ping!

I think the review this patch really needs is a comparison to GCC's 
implementation to double-check that it really does the same thing that GCC 
does. Is there a gcov user who could take a look at this?


https://reviews.llvm.org/D23734



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


Re: r279765 - Omit column info for CodeView by default

2016-08-29 Thread Adrian McCarthy via cfe-commits
Sorry, no, I don't have plans to implement column ranges at this time.

On Mon, Aug 29, 2016 at 2:10 PM, Adrian Prantl  wrote:

>
> > On Aug 25, 2016, at 11:24 AM, Adrian McCarthy via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
> >
> > Author: amccarth
> > Date: Thu Aug 25 13:24:35 2016
> > New Revision: 279765
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=279765=rev
> > Log:
> > Omit column info for CodeView by default
> >
> > Clang tracks only start columns, not start-end ranges. CodeView allows
> for that, but the VS debugger doesn't handle anything less than a complete
> range well--it either highlights the wrong part of a statement or truncates
> source lines in the assembly view. It's better to have no column
> information at all.
>
> Do you have any plans on implementing this? I'd be very interested in
> having full start-end ranges (perhaps encoded as start line/column+length)
> available in DWARF, too.
>
> -- adrian
>
> >
> > So by default, we'll omit the column information for CodeView targeting
> Windows.
> >
> > Since the column info is still useful for sanitizers, I've promoted
> -gcolumn-info (and -gno-column-info) to a CoreOption and added a couple
> tests to make sure that works for clang-cl.
> >
> > Differential Revision: https://reviews.llvm.org/D23720
> >
> > Modified:
> >cfe/trunk/include/clang/Driver/Options.td
> >cfe/trunk/lib/Driver/Tools.cpp
> >cfe/trunk/test/Driver/cl-options.c
> >
> > Modified: cfe/trunk/include/clang/Driver/Options.td
> > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/
> clang/Driver/Options.td?rev=279765=279764=279765=diff
> > 
> ==
> > --- cfe/trunk/include/clang/Driver/Options.td (original)
> > +++ cfe/trunk/include/clang/Driver/Options.td Thu Aug 25 13:24:35 2016
> > @@ -1305,8 +1305,8 @@ def gno_record_gcc_switches : Flag<["-"]
> >   Group;
> > def gstrict_dwarf : Flag<["-"], "gstrict-dwarf">, Group;
> > def gno_strict_dwarf : Flag<["-"], "gno-strict-dwarf">,
> Group;
> > -def gcolumn_info : Flag<["-"], "gcolumn-info">, Group;
> > -def gno_column_info : Flag<["-"], "gno-column-info">,
> Group;
> > +def gcolumn_info : Flag<["-"], "gcolumn-info">, Group,
> Flags<[CoreOption]>;
> > +def gno_column_info : Flag<["-"], "gno-column-info">,
> Group, Flags<[CoreOption]>;
> > def gsplit_dwarf : Flag<["-"], "gsplit-dwarf">, Group;
> > def ggnu_pubnames : Flag<["-"], "ggnu-pubnames">, Group;
> > def gdwarf_aranges : Flag<["-"], "gdwarf-aranges">, Group;
> >
> > Modified: cfe/trunk/lib/Driver/Tools.cpp
> > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/
> Tools.cpp?rev=279765=279764=279765=diff
> > 
> ==
> > --- cfe/trunk/lib/Driver/Tools.cpp (original)
> > +++ cfe/trunk/lib/Driver/Tools.cpp Thu Aug 25 13:24:35 2016
> > @@ -2574,7 +2574,7 @@ static void getTargetFeatures(const Tool
> >   case llvm::Triple::wasm32:
> >   case llvm::Triple::wasm64:
> > getWebAssemblyTargetFeatures(Args, Features);
> > -break;
> > +break;
> >   case llvm::Triple::sparc:
> >   case llvm::Triple::sparcel:
> >   case llvm::Triple::sparcv9:
> > @@ -4656,9 +4656,13 @@ void Clang::ConstructJob(Compilation ,
> >   // We ignore flags -gstrict-dwarf and -grecord-gcc-switches for now.
> >   Args.ClaimAllArgs(options::OPT_g_flags_Group);
> >
> > -  // PS4 defaults to no column info
> > +  // Column info is included by default for everything except PS4 and
> CodeView.
> > +  // Clang doesn't track end columns, just starting columns, which, in
> theory,
> > +  // is fine for CodeView (and PDB).  In practice, however, the
> Microsoft
> > +  // debuggers don't handle missing end columns well, so it's better
> not to
> > +  // include any column info.
> >   if (Args.hasFlag(options::OPT_gcolumn_info,
> options::OPT_gno_column_info,
> > -   /*Default=*/ !IsPS4CPU))
> > +   /*Default=*/ !IsPS4CPU && !(IsWindowsMSVC &&
> EmitCodeView)))
> > CmdArgs.push_back("-dwarf-column-info");
> >
> >   // FIXME: Move backend command line options to the module.
> > @@ -6712,7 +6716,7 @@ void ClangAs::ConstructJob(Compilation &
> >   case llvm::Triple::mips64el:
> > AddMIPSTargetArgs(Args, CmdArgs);
> > break;
> > -
> > +
> >   case llvm::Triple::x86:
> >   case llvm::Triple::x86_64:
> > AddX86TargetArgs(Args, CmdArgs);
> >
> > Modified: cfe/trunk/test/Driver/cl-options.c
> > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/
> cl-options.c?rev=279765=279764=279765=diff
> > 
> ==
> > --- cfe/trunk/test/Driver/cl-options.c (original)
> > +++ cfe/trunk/test/Driver/cl-options.c Thu Aug 25 13:24:35 2016
> > @@ -50,6 +50,15 @@
> > // fpstrict-NOT: -menable-unsafe-fp-math
> > // fpstrict-NOT: -ffast-math
> >
> > +// RUN: %clang_cl /Z7 -gcolumn-info -### -- %s 

Re: r279765 - Omit column info for CodeView by default

2016-08-29 Thread Adrian Prantl via cfe-commits

> On Aug 25, 2016, at 11:24 AM, Adrian McCarthy via cfe-commits 
>  wrote:
> 
> Author: amccarth
> Date: Thu Aug 25 13:24:35 2016
> New Revision: 279765
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=279765=rev
> Log:
> Omit column info for CodeView by default
> 
> Clang tracks only start columns, not start-end ranges. CodeView allows for 
> that, but the VS debugger doesn't handle anything less than a complete range 
> well--it either highlights the wrong part of a statement or truncates source 
> lines in the assembly view. It's better to have no column information at all.

Do you have any plans on implementing this? I'd be very interested in having 
full start-end ranges (perhaps encoded as start line/column+length) available 
in DWARF, too.

-- adrian

> 
> So by default, we'll omit the column information for CodeView targeting 
> Windows.
> 
> Since the column info is still useful for sanitizers, I've promoted 
> -gcolumn-info (and -gno-column-info) to a CoreOption and added a couple tests 
> to make sure that works for clang-cl.
> 
> Differential Revision: https://reviews.llvm.org/D23720
> 
> Modified:
>cfe/trunk/include/clang/Driver/Options.td
>cfe/trunk/lib/Driver/Tools.cpp
>cfe/trunk/test/Driver/cl-options.c
> 
> Modified: cfe/trunk/include/clang/Driver/Options.td
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=279765=279764=279765=diff
> ==
> --- cfe/trunk/include/clang/Driver/Options.td (original)
> +++ cfe/trunk/include/clang/Driver/Options.td Thu Aug 25 13:24:35 2016
> @@ -1305,8 +1305,8 @@ def gno_record_gcc_switches : Flag<["-"]
>   Group;
> def gstrict_dwarf : Flag<["-"], "gstrict-dwarf">, Group;
> def gno_strict_dwarf : Flag<["-"], "gno-strict-dwarf">, Group;
> -def gcolumn_info : Flag<["-"], "gcolumn-info">, Group;
> -def gno_column_info : Flag<["-"], "gno-column-info">, Group;
> +def gcolumn_info : Flag<["-"], "gcolumn-info">, Group, 
> Flags<[CoreOption]>;
> +def gno_column_info : Flag<["-"], "gno-column-info">, Group, 
> Flags<[CoreOption]>;
> def gsplit_dwarf : Flag<["-"], "gsplit-dwarf">, Group;
> def ggnu_pubnames : Flag<["-"], "ggnu-pubnames">, Group;
> def gdwarf_aranges : Flag<["-"], "gdwarf-aranges">, Group;
> 
> Modified: cfe/trunk/lib/Driver/Tools.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=279765=279764=279765=diff
> ==
> --- cfe/trunk/lib/Driver/Tools.cpp (original)
> +++ cfe/trunk/lib/Driver/Tools.cpp Thu Aug 25 13:24:35 2016
> @@ -2574,7 +2574,7 @@ static void getTargetFeatures(const Tool
>   case llvm::Triple::wasm32:
>   case llvm::Triple::wasm64:
> getWebAssemblyTargetFeatures(Args, Features);
> -break; 
> +break;
>   case llvm::Triple::sparc:
>   case llvm::Triple::sparcel:
>   case llvm::Triple::sparcv9:
> @@ -4656,9 +4656,13 @@ void Clang::ConstructJob(Compilation ,
>   // We ignore flags -gstrict-dwarf and -grecord-gcc-switches for now.
>   Args.ClaimAllArgs(options::OPT_g_flags_Group);
> 
> -  // PS4 defaults to no column info
> +  // Column info is included by default for everything except PS4 and 
> CodeView.
> +  // Clang doesn't track end columns, just starting columns, which, in 
> theory,
> +  // is fine for CodeView (and PDB).  In practice, however, the Microsoft
> +  // debuggers don't handle missing end columns well, so it's better not to
> +  // include any column info.
>   if (Args.hasFlag(options::OPT_gcolumn_info, options::OPT_gno_column_info,
> -   /*Default=*/ !IsPS4CPU))
> +   /*Default=*/ !IsPS4CPU && !(IsWindowsMSVC && 
> EmitCodeView)))
> CmdArgs.push_back("-dwarf-column-info");
> 
>   // FIXME: Move backend command line options to the module.
> @@ -6712,7 +6716,7 @@ void ClangAs::ConstructJob(Compilation &
>   case llvm::Triple::mips64el:
> AddMIPSTargetArgs(Args, CmdArgs);
> break;
> -
> +
>   case llvm::Triple::x86:
>   case llvm::Triple::x86_64:
> AddX86TargetArgs(Args, CmdArgs);
> 
> Modified: cfe/trunk/test/Driver/cl-options.c
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-options.c?rev=279765=279764=279765=diff
> ==
> --- cfe/trunk/test/Driver/cl-options.c (original)
> +++ cfe/trunk/test/Driver/cl-options.c Thu Aug 25 13:24:35 2016
> @@ -50,6 +50,15 @@
> // fpstrict-NOT: -menable-unsafe-fp-math
> // fpstrict-NOT: -ffast-math
> 
> +// RUN: %clang_cl /Z7 -gcolumn-info -### -- %s 2>&1 | FileCheck 
> -check-prefix=gcolumn %s
> +// gcolumn: -dwarf-column-info
> +
> +// RUN: %clang_cl /Z7 -gno-column-info -### -- %s 2>&1 | FileCheck 
> -check-prefix=gnocolumn %s
> +// gnocolumn-NOT: -dwarf-column-info
> +
> +// RUN: %clang_cl /Z7 -### -- %s 2>&1 | FileCheck -check-prefix=gdefcolumn %s
> +// gdefcolumn-NOT: 

r280009 - Fix a bug preventing the cause of a module-out-of-date error from being printed

2016-08-29 Thread Adrian Prantl via cfe-commits
Author: adrian
Date: Mon Aug 29 15:46:56 2016
New Revision: 280009

URL: http://llvm.org/viewvc/llvm-project?rev=280009=rev
Log:
Fix a bug preventing the cause of a module-out-of-date error from being printed

Modified:
cfe/trunk/lib/Serialization/ASTReader.cpp
cfe/trunk/test/Modules/explicit-build.cpp

Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=280009=280008=280009=diff
==
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Mon Aug 29 15:46:56 2016
@@ -3769,7 +3769,7 @@ ASTReader::ReadASTCore(StringRef FileNam
 
 // Otherwise, return an error.
 Diag(diag::err_module_file_out_of_date) << moduleKindForDiagnostic(Type)
-<< FileName << ErrorStr.empty()
+<< FileName << !ErrorStr.empty()
 << ErrorStr;
 return Failure;
   }

Modified: cfe/trunk/test/Modules/explicit-build.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/explicit-build.cpp?rev=280009=280008=280009=diff
==
--- cfe/trunk/test/Modules/explicit-build.cpp (original)
+++ cfe/trunk/test/Modules/explicit-build.cpp Mon Aug 29 15:46:56 2016
@@ -199,6 +199,6 @@
 // RUN:-fmodule-file=%t/c.pcm \
 // RUN:%s -DHAVE_A -DHAVE_B -DHAVE_C 2>&1 | FileCheck 
--check-prefix=CHECK-MISMATCHED-B %s
 //
-// CHECK-MISMATCHED-B:  fatal error: module file '{{.*}}b.pcm' is out of 
date and needs to be rebuilt
+// CHECK-MISMATCHED-B:  fatal error: module file '{{.*}}b.pcm' is out of 
date and needs to be rebuilt: module file out of date
 // CHECK-MISMATCHED-B-NEXT: note: imported by module 'c'
 // CHECK-MISMATCHED-B-NOT:  note:


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


Re: [PATCH] D21698: [OpenCL] Allow disabling types and declarations associate with extensions

2016-08-29 Thread Yaxun Liu via cfe-commits
yaxunl retitled this revision from "[OpenCL] Allow user to add supported OpenCL 
extensions by pragma" to "[OpenCL] Allow disabling types and declarations 
associate with extensions".
yaxunl updated the summary for this revision.
yaxunl updated this revision to Diff 69606.
yaxunl added a comment.

Added association of types and declarations with extensions and diagnostics. I 
would like to update opencl-c.h in a separate patch.


https://reviews.llvm.org/D21698

Files:
  include/clang/Basic/DiagnosticParseKinds.td
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Basic/OpenCLImageTypes.def
  include/clang/Basic/OpenCLOptions.h
  include/clang/Sema/Overload.h
  include/clang/Sema/Sema.h
  include/clang/Serialization/ASTReader.h
  lib/Basic/Targets.cpp
  lib/Frontend/InitPreprocessor.cpp
  lib/Headers/opencl-c.h
  lib/Parse/ParsePragma.cpp
  lib/Parse/Parser.cpp
  lib/Sema/DeclSpec.cpp
  lib/Sema/Sema.cpp
  lib/Sema/SemaCast.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaExpr.cpp
  lib/Sema/SemaOverload.cpp
  lib/Sema/SemaType.cpp
  lib/Serialization/ASTReader.cpp
  lib/Serialization/ASTWriter.cpp
  test/CodeGenOpenCL/extension-begin.cl
  test/Parser/opencl-atomics-cl20.cl
  test/Parser/opencl-pragma.cl
  test/SemaOpenCL/extension-begin.cl

Index: test/SemaOpenCL/extension-begin.cl
===
--- /dev/null
+++ test/SemaOpenCL/extension-begin.cl
@@ -0,0 +1,34 @@
+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -verify -pedantic -fsyntax-only
+
+#pragma OPENCL EXTENSION all : begin // expected-warning {{expected 'disable' - ignoring}}
+#pragma OPENCL EXTENSION all : end // expected-warning {{expected 'disable' - ignoring}}
+
+#pragma OPENCL EXTENSION my_ext : begin 
+
+struct A {
+  int a;
+};
+
+void f(void);
+
+__attribute__((overloadable)) void g(long x);
+
+#pragma OPENCL EXTENSION my_ext : end
+
+__attribute__((overloadable)) void g(void);
+
+#pragma OPENCL EXTENSION my_ext : enable
+void test_f1(void) {
+  struct A test_A1;
+  f();
+  g(0);
+}
+
+#pragma OPENCL EXTENSION my_ext : disable 
+void test_f2(void) {
+  struct A test_A2; // expected-error {{use of type 'struct A' requires my_ext extension to be enabled}}
+  f(); // expected-error {{use of declaration requires my_ext extension to be enabled}}
+  g(0); // expected-error {{no matching function for call to 'g'}}
+// expected-note@-18 {{candidate disabled due to OpenCL extension}}
+// expected-note@-15 {{candidate function not viable: requires 0 arguments, but 1 was provided}}
+}
Index: test/Parser/opencl-pragma.cl
===
--- test/Parser/opencl-pragma.cl
+++ test/Parser/opencl-pragma.cl
@@ -5,9 +5,9 @@
 #pragma OPENCL EXTENSION cl_no_such_extension : disable /* expected-warning {{unknown OpenCL extension 'cl_no_such_extension' - ignoring}} */
 
 #pragma OPENCL EXTENSION all : disable
-#pragma OPENCL EXTENSION all : enable /* expected-warning {{unknown OpenCL extension 'all' - ignoring}} */
+#pragma OPENCL EXTENSION all : enable /* expected-warning {{expected 'disable' - ignoring}} */
 
-#pragma OPENCL EXTENSION cl_khr_fp64 : on /* expected-warning {{expected 'enable' or 'disable' - ignoring}} */
+#pragma OPENCL EXTENSION cl_khr_fp64 : on /* expected-warning {{expected 'enable', 'disable', 'begin' or 'end' - ignoring}} */
 
 #pragma OPENCL FP_CONTRACT ON
 #pragma OPENCL FP_CONTRACT OFF
Index: test/Parser/opencl-atomics-cl20.cl
===
--- test/Parser/opencl-atomics-cl20.cl
+++ test/Parser/opencl-atomics-cl20.cl
@@ -1,5 +1,6 @@
 // RUN: %clang_cc1 %s -triple spir-unknown-unknown -verify -pedantic -fsyntax-only
 // RUN: %clang_cc1 %s -triple spir-unknown-unknown -verify -fsyntax-only -cl-std=CL2.0 -DCL20
+// RUN: %clang_cc1 %s -triple spir64-unknown-unknown -verify -fsyntax-only -cl-std=CL2.0 -DCL20
 // RUN: %clang_cc1 %s -triple spir-unknown-unknown -verify -fsyntax-only -cl-std=CL2.0 -DCL20 -DEXT -Wpedantic-core-features
 
 #ifdef EXT
@@ -47,14 +48,16 @@
 // expected-error@-28 {{use of type 'atomic_ulong' (aka '_Atomic(unsigned long)') requires cl_khr_int64_extended_atomics extension to be enabled}}
 // expected-error@-27 {{use of type 'atomic_double' (aka '_Atomic(double)') requires cl_khr_int64_base_atomics extension to be enabled}}
 // expected-error@-28 {{use of type 'atomic_double' (aka '_Atomic(double)') requires cl_khr_int64_extended_atomics extension to be enabled}}
-// expected-error-re@-27 {{use of type 'atomic_intptr_t' (aka '_Atomic({{.+}})') requires cl_khr_int64_base_atomics extension to be enabled}}
-// expected-error-re@-28 {{use of type 'atomic_intptr_t' (aka '_Atomic({{.+}})') requires cl_khr_int64_extended_atomics extension to be enabled}}
-// expected-error-re@-28 {{use of type 'atomic_uintptr_t' (aka '_Atomic({{.+}})') requires cl_khr_int64_base_atomics extension to be enabled}}
-// expected-error-re@-29 {{use of type 

Re: [PATCH] D23856: [libc++] Perform configuration checks with -nodefaultlibs

2016-08-29 Thread Shoaib Meenai via cfe-commits
smeenai marked an inline comment as done.
smeenai added a comment.

https://reviews.llvm.org/D23856



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


Re: [PATCH] D23856: [libc++] Perform configuration checks with -nodefaultlibs

2016-08-29 Thread Shoaib Meenai via cfe-commits
smeenai updated this revision to Diff 69607.
smeenai added a comment.

Putting -nodefaultlibs in CMAKE_REQUIRED_FLAGS


https://reviews.llvm.org/D23856

Files:
  cmake/Modules/CheckLibcxxAtomic.cmake
  cmake/config-ix.cmake

Index: cmake/config-ix.cmake
===
--- cmake/config-ix.cmake
+++ cmake/config-ix.cmake
@@ -1,5 +1,34 @@
 include(CheckLibraryExists)
 include(CheckCXXCompilerFlag)
+
+check_library_exists(c fopen "" LIBCXX_HAS_C_LIB)
+if (NOT LIBCXX_USE_COMPILER_RT)
+  check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB)
+endif()
+
+# libc++ is built with -nodefaultlibs, so we want all our checks to also
+# use this option, otherwise we may end up with an inconsistency between
+# the flags we think we require during configuration (if the checks are
+# performed without -nodefaultlibs) and the flags that are actually
+# required during compilation (which has the -nodefaultlibs). libc is
+# required for the link to go through. We remove sanitizers from the
+# configuration checks to avoid spurious link errors.
+check_cxx_compiler_flag(-nodefaultlibs LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG)
+if (LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG)
+  set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nodefaultlibs")
+  if (LIBCXX_HAS_C_LIB)
+list(APPEND CMAKE_REQUIRED_LIBRARIES c)
+  endif ()
+  if (LIBCXX_USE_COMPILER_RT)
+list(APPEND CMAKE_REQUIRED_LIBRARIES -rtlib=compiler-rt)
+  elseif (LIBCXX_HAS_GCC_S_LIB)
+list(APPEND CMAKE_REQUIRED_LIBRARIES gcc_s)
+  endif ()
+  if (CMAKE_C_FLAGS MATCHES -fsanitize OR CMAKE_CXX_FLAGS MATCHES -fsanitize)
+set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fno-sanitize=all")
+  endif ()
+endif ()
+
 include(CheckLibcxxAtomic)
 
 # Check compiler flags
@@ -14,9 +43,5 @@
 
 # Check libraries
 check_library_exists(pthread pthread_create "" LIBCXX_HAS_PTHREAD_LIB)
-check_library_exists(c fopen "" LIBCXX_HAS_C_LIB)
 check_library_exists(m ccos "" LIBCXX_HAS_M_LIB)
 check_library_exists(rt clock_gettime "" LIBCXX_HAS_RT_LIB)
-if (NOT LIBCXX_USE_COMPILER_RT)
-  check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB)
-endif()
Index: cmake/Modules/CheckLibcxxAtomic.cmake
===
--- cmake/Modules/CheckLibcxxAtomic.cmake
+++ cmake/Modules/CheckLibcxxAtomic.cmake
@@ -9,10 +9,13 @@
 
 function(check_cxx_atomics varname)
   set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
-  set(CMAKE_REQUIRED_FLAGS "-std=c++11 -nostdinc++ -isystem 
${LIBCXX_SOURCE_DIR}/include")
+  set(CMAKE_REQUIRED_FLAGS "-nodefaultlibs -std=c++11 -nostdinc++ -isystem 
${LIBCXX_SOURCE_DIR}/include")
   if (${LIBCXX_GCC_TOOLCHAIN})
 set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} 
--gcc-toolchain=${LIBCXX_GCC_TOOLCHAIN}")
   endif()
+  if (CMAKE_C_FLAGS MATCHES -fsanitize OR CMAKE_CXX_FLAGS MATCHES -fsanitize)
+set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fno-sanitize=all")
+  endif()
   check_cxx_source_compiles("
 #include 
 #include 


Index: cmake/config-ix.cmake
===
--- cmake/config-ix.cmake
+++ cmake/config-ix.cmake
@@ -1,5 +1,34 @@
 include(CheckLibraryExists)
 include(CheckCXXCompilerFlag)
+
+check_library_exists(c fopen "" LIBCXX_HAS_C_LIB)
+if (NOT LIBCXX_USE_COMPILER_RT)
+  check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB)
+endif()
+
+# libc++ is built with -nodefaultlibs, so we want all our checks to also
+# use this option, otherwise we may end up with an inconsistency between
+# the flags we think we require during configuration (if the checks are
+# performed without -nodefaultlibs) and the flags that are actually
+# required during compilation (which has the -nodefaultlibs). libc is
+# required for the link to go through. We remove sanitizers from the
+# configuration checks to avoid spurious link errors.
+check_cxx_compiler_flag(-nodefaultlibs LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG)
+if (LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG)
+  set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nodefaultlibs")
+  if (LIBCXX_HAS_C_LIB)
+list(APPEND CMAKE_REQUIRED_LIBRARIES c)
+  endif ()
+  if (LIBCXX_USE_COMPILER_RT)
+list(APPEND CMAKE_REQUIRED_LIBRARIES -rtlib=compiler-rt)
+  elseif (LIBCXX_HAS_GCC_S_LIB)
+list(APPEND CMAKE_REQUIRED_LIBRARIES gcc_s)
+  endif ()
+  if (CMAKE_C_FLAGS MATCHES -fsanitize OR CMAKE_CXX_FLAGS MATCHES -fsanitize)
+set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fno-sanitize=all")
+  endif ()
+endif ()
+
 include(CheckLibcxxAtomic)
 
 # Check compiler flags
@@ -14,9 +43,5 @@
 
 # Check libraries
 check_library_exists(pthread pthread_create "" LIBCXX_HAS_PTHREAD_LIB)
-check_library_exists(c fopen "" LIBCXX_HAS_C_LIB)
 check_library_exists(m ccos "" LIBCXX_HAS_M_LIB)
 check_library_exists(rt clock_gettime "" LIBCXX_HAS_RT_LIB)
-if (NOT LIBCXX_USE_COMPILER_RT)
-  check_library_exists(gcc_s __gcc_personality_v0 "" 

Re: [PATCH] D23999: [libc++] Minimal std::tuple fix for PR29123

2016-08-29 Thread Richard Smith via cfe-commits
rsmith added a comment.

Ouch. This testcase is horrible. Note that we find two different ways to 
convert `Optional` to itself: the obvious way, and 
`Optional -> dynamic -> std::tuple -> 
Optional` (because `tuple`'s conversion happens inside its 
converting constructor, this sidesteps the "at most one user-defined 
conversion" restriction). The reason for the problem is that when overload 
resolution explores the second path, libc++'s SFINAE checks enter a cycle, and 
`is_convertible`'s result for this conversion ends up defined in terms of 
itself.

Now, there *is* a Clang bug here -- a `constexpr` function template 
specialization can trigger its own recursive instantiation. Reduced reproducer:

  template constexpr int f(T t) { return g(t); }
  template constexpr int g(T t) { return f(t); }
  struct X {};
  constexpr int k = f(X());

With that fixed, you'll get an arbitrary answer from `is_convertible` here 
rather than a compile-time error, but the root cause of the problem in this 
testcase (the cycle) will remain and will result in weird misbehavior in some 
cases. Consider the following:

  template  struct is_convertible { static const bool 
value = __is_convertible_to(T, U); };
  template struct enable_if; template<> struct enable_if { using 
type = void; };
  
  template struct tuple {
// tuple::tuple(U&&...) requires each T is constructible from the 
corresponding U
template::value>::type> tuple(U);
  };
  template struct optional {
// optional(const T&) requires T is copy-constructible, but that doesn't 
affect our example
optional(T);
  };
  struct any {
// any::any(ValueType&&) requires decay_t is CopyConstructible.
template::value>::type> any(T);
  };
  
  #ifdef WRONG
  static_assert(is_convertible, 
optional>::value == true);
  static_assert(is_convertible, any>::value == false);
  #else
  static_assert(is_convertible, any>::value == true);
  static_assert(is_convertible, 
optional>::value == true);
  #endif

This testcase has essentially the same character as the original one, except 
that I cut out a lot of irrelevant complexity and explicitly added a use of 
`is_convertible` to `any` to make the problem easier to observe (and renamed 
the classes to match the names in the standard library). Note that:

- instantiating `is_convertible, o>` triggers instantiation of 
`is_convertible, a>`, because it tries to construct a `t` from an 
`o`, which tries to use the `tuple(U)` constructor with `U = o`
- instantiating `is_convertible, a>` triggers instantiation of 
`is_convertible, o>`, because it tries to construct a `a` from an 
`o`

Now, depending on where we enter this cycle, we get different answers for the 
type traits, because when we get back to our starting point in the cycle, we 
get a SFINAE failure (because we've not instantiated `::value` yet) and the 
previous `is_convertible` step will evaluate to `false` if there's no other way 
to perform the conversion. (In the `-UWRONG` case, there's another way to 
convert `o` to `o`, but in the `-DWRONG` case there is no other way 
to convert `o` to `a`.)

Arguably the bug here is in the definition of class `optional`, which triggered 
overload resolution from `optional` to `T` when constructing from an argument 
of type `optional`... but it seems unreasonable to expect `optional` to avoid 
that (and likewise for user-defined types like `Optional` in the testcase for 
this patch).


https://reviews.llvm.org/D23999



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


Re: [PATCH] D23944: Parsing MS pragma intrinsic

2016-08-29 Thread Albert Gutowski via cfe-commits
agutowski marked 2 inline comments as done.
agutowski added a comment.

https://reviews.llvm.org/D23944



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


Re: [PATCH] D23944: Parsing MS pragma intrinsic

2016-08-29 Thread Albert Gutowski via cfe-commits
agutowski updated this revision to Diff 69605.
agutowski added a comment.

Changed warning messages


https://reviews.llvm.org/D23944

Files:
  include/clang/Basic/DiagnosticParseKinds.td
  include/clang/Parse/Parser.h
  lib/Parse/ParsePragma.cpp
  test/Preprocessor/pragma_microsoft.c

Index: lib/Parse/ParsePragma.cpp
===
--- lib/Parse/ParsePragma.cpp
+++ lib/Parse/ParsePragma.cpp
@@ -161,6 +161,12 @@
   PragmaMSRuntimeChecksHandler() : EmptyPragmaHandler("runtime_checks") {}
 };
 
+struct PragmaMSIntrinsicHandler : public PragmaHandler {
+  PragmaMSIntrinsicHandler() : PragmaHandler("intrinsic") {}
+  void HandlePragma(Preprocessor , PragmaIntroducerKind Introducer,
+Token ) override;
+};
+
 }  // end namespace
 
 void Parser::initializePragmaHandlers() {
@@ -229,6 +235,8 @@
 PP.AddPragmaHandler(MSSection.get());
 MSRuntimeChecks.reset(new PragmaMSRuntimeChecksHandler());
 PP.AddPragmaHandler(MSRuntimeChecks.get());
+MSIntrinsic.reset(new PragmaMSIntrinsicHandler());
+PP.AddPragmaHandler(MSIntrinsic.get());
   }
 
   OptimizeHandler.reset(new PragmaOptimizeHandler(Actions));
@@ -297,6 +305,8 @@
 MSSection.reset();
 PP.RemovePragmaHandler(MSRuntimeChecks.get());
 MSRuntimeChecks.reset();
+PP.RemovePragmaHandler(MSIntrinsic.get());
+MSIntrinsic.reset();
   }
 
   PP.RemovePragmaHandler("STDC", FPContractHandler.get());
@@ -2127,3 +2137,57 @@
   PP.EnterTokenStream(std::move(TokenArray), 1,
   /*DisableMacroExpansion=*/false);
 }
+
+/// \brief Handle the Microsoft \#pragma intrinsic extension.
+/// The syntax is:
+/// \code
+///  #pragma intrinsic(memset)
+///  #pragma intrinsic(strlen, memcpy)
+/// \endcode
+///
+/// Pragma intrisic tells compiler to use a builtin version of function.
+/// Clang does it anyway, so the pragma doesn't really do anything.
+/// Anyway, we emit a warning if the function specified in pragma intrinsic
+/// isn't an intrinsic in clang and suggest to include intrin.h.
+void PragmaMSIntrinsicHandler::HandlePragma(Preprocessor ,
+PragmaIntroducerKind Introducer,
+Token ) {
+  PP.Lex(Tok);
+
+  if (Tok.isNot(tok::l_paren)) {
+PP.Diag(Tok.getLocation(), diag::warn_pragma_expected_lparen)
+<< "intrinsic";
+return;
+  }
+  PP.Lex(Tok);
+
+  bool SuggestIntrinH = !PP.isMacroDefined("__INTRIN_H");
+
+  while (Tok.is(tok::identifier)) {
+IdentifierInfo *II = Tok.getIdentifierInfo();
+if (II->getBuiltinID() < 2) {
+  if (SuggestIntrinH) {
+PP.Diag(Tok.getLocation(), diag::warn_pragma_intrinsic_builtin_suggest)
+<< II;
+  } else {
+PP.Diag(Tok.getLocation(), diag::warn_pragma_intrinsic_builtin) << II;
+  }
+}
+
+PP.Lex(Tok);
+if (Tok.isNot(tok::comma))
+  break;
+PP.Lex(Tok);
+  }
+
+  if (Tok.isNot(tok::r_paren)) {
+PP.Diag(Tok.getLocation(), diag::warn_pragma_expected_rparen)
+<< "intrinsic";
+return;
+  }
+  PP.Lex(Tok);
+
+  if (Tok.isNot(tok::eod))
+PP.Diag(Tok.getLocation(), diag::warn_pragma_extra_tokens_at_eol)
+<< "intrinsic";
+}
Index: include/clang/Parse/Parser.h
===
--- include/clang/Parse/Parser.h
+++ include/clang/Parse/Parser.h
@@ -172,6 +172,7 @@
   std::unique_ptr MSCodeSeg;
   std::unique_ptr MSSection;
   std::unique_ptr MSRuntimeChecks;
+  std::unique_ptr MSIntrinsic;
   std::unique_ptr OptimizeHandler;
   std::unique_ptr LoopHintHandler;
   std::unique_ptr UnrollHintHandler;
Index: include/clang/Basic/DiagnosticParseKinds.td
===
--- include/clang/Basic/DiagnosticParseKinds.td
+++ include/clang/Basic/DiagnosticParseKinds.td
@@ -911,6 +911,13 @@
 def warn_pragma_pack_malformed : Warning<
   "expected integer or identifier in '#pragma pack' - ignored">,
   InGroup;
+// - #pragma intrinsic
+def warn_pragma_intrinsic_builtin : Warning<
+  "%0 is not a recognized builtin">,
+  InGroup;
+def warn_pragma_intrinsic_builtin_suggest : Warning<
+  "%0 is not a recognized builtin; consider including  to access non-builtin intrinsics">,
+  InGroup;
 // - #pragma unused
 def warn_pragma_unused_expected_var : Warning<
   "expected '#pragma unused' argument to be a variable name">,
Index: test/Preprocessor/pragma_microsoft.c
===
--- test/Preprocessor/pragma_microsoft.c
+++ test/Preprocessor/pragma_microsoft.c
@@ -162,3 +162,19 @@
 
 // Test that runtime_checks is parsed but ignored.
 #pragma runtime_checks("sc", restore) // no-warning
+
+// Test pragma intrinsic
+#pragma intrinsic(memset) // no-warning
+#pragma intrinsic(memcpy, strlen, strlen) // no-warning
+#pragma intrinsic() // no-warning
+#pragma intrinsic(asdf) // expected-warning {{'asdf' is not a 

[PATCH] D24002: clang-rename: improve error message when -old-name is used and could not find symbol

2016-08-29 Thread Miklos Vajna via cfe-commits
vmiklos created this revision.
vmiklos added reviewers: klimek, omtcyfz.
vmiklos added a subscriber: cfe-commits.

Old output was:

clang-rename: could not find symbol at 
tools/clang/tools/extra/test/clang-rename/ClassFindByName.cpp:1:1 (offset 0). 

https://reviews.llvm.org/D24002

Files:
  clang-rename/USRFindingAction.cpp
  test/clang-rename/InvalidOldName.cpp

Index: test/clang-rename/InvalidOldName.cpp
===
--- /dev/null
+++ test/clang-rename/InvalidOldName.cpp
@@ -0,0 +1,2 @@
+// RUN: not clang-rename rename-all -new-name=Foo -old-name=Bar %s -- 2>&1 | 
FileCheck %s
+// CHECK: clang-rename: could not find symbol named Bar.
Index: clang-rename/USRFindingAction.cpp
===
--- clang-rename/USRFindingAction.cpp
+++ clang-rename/USRFindingAction.cpp
@@ -157,12 +157,16 @@
   FoundDecl = getNamedDeclFor(Context, OldName);
 }
 if (FoundDecl == nullptr) {
-  FullSourceLoc FullLoc(Point, SourceMgr);
-  errs() << "clang-rename: could not find symbol at "
- << SourceMgr.getFilename(Point) << ":"
- << FullLoc.getSpellingLineNumber() << ":"
- << FullLoc.getSpellingColumnNumber() << " (offset " << 
SymbolOffset
- << ").\n";
+  if (OldName.empty()) {
+FullSourceLoc FullLoc(Point, SourceMgr);
+errs() << "clang-rename: could not find symbol at "
+   << SourceMgr.getFilename(Point) << ":"
+   << FullLoc.getSpellingLineNumber() << ":"
+   << FullLoc.getSpellingColumnNumber() << " (offset "
+   << SymbolOffset << ").\n";
+  } else
+errs() << "clang-rename: could not find symbol named " << OldName
+   << ".\n";
   return;
 }
 


Index: test/clang-rename/InvalidOldName.cpp
===
--- /dev/null
+++ test/clang-rename/InvalidOldName.cpp
@@ -0,0 +1,2 @@
+// RUN: not clang-rename rename-all -new-name=Foo -old-name=Bar %s -- 2>&1 | FileCheck %s
+// CHECK: clang-rename: could not find symbol named Bar.
Index: clang-rename/USRFindingAction.cpp
===
--- clang-rename/USRFindingAction.cpp
+++ clang-rename/USRFindingAction.cpp
@@ -157,12 +157,16 @@
   FoundDecl = getNamedDeclFor(Context, OldName);
 }
 if (FoundDecl == nullptr) {
-  FullSourceLoc FullLoc(Point, SourceMgr);
-  errs() << "clang-rename: could not find symbol at "
- << SourceMgr.getFilename(Point) << ":"
- << FullLoc.getSpellingLineNumber() << ":"
- << FullLoc.getSpellingColumnNumber() << " (offset " << SymbolOffset
- << ").\n";
+  if (OldName.empty()) {
+FullSourceLoc FullLoc(Point, SourceMgr);
+errs() << "clang-rename: could not find symbol at "
+   << SourceMgr.getFilename(Point) << ":"
+   << FullLoc.getSpellingLineNumber() << ":"
+   << FullLoc.getSpellingColumnNumber() << " (offset "
+   << SymbolOffset << ").\n";
+  } else
+errs() << "clang-rename: could not find symbol named " << OldName
+   << ".\n";
   return;
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r279989 - Update Google Benchmark library.

2016-08-29 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Mon Aug 29 14:12:01 2016
New Revision: 279989

URL: http://llvm.org/viewvc/llvm-project?rev=279989=rev
Log:
Update Google Benchmark library.

Added:
libcxx/trunk/utils/google-benchmark/test/output_test.h
libcxx/trunk/utils/google-benchmark/test/output_test_helper.cc
Removed:
libcxx/trunk/utils/google-benchmark/mingw.py
Modified:
libcxx/trunk/utils/google-benchmark/CMakeLists.txt
libcxx/trunk/utils/google-benchmark/README.md
libcxx/trunk/utils/google-benchmark/cmake/CXXFeatureCheck.cmake
libcxx/trunk/utils/google-benchmark/include/benchmark/benchmark_api.h
libcxx/trunk/utils/google-benchmark/include/benchmark/macros.h
libcxx/trunk/utils/google-benchmark/src/CMakeLists.txt
libcxx/trunk/utils/google-benchmark/src/benchmark.cc
libcxx/trunk/utils/google-benchmark/test/CMakeLists.txt
libcxx/trunk/utils/google-benchmark/test/complexity_test.cc
libcxx/trunk/utils/google-benchmark/test/cxx03_test.cc
libcxx/trunk/utils/google-benchmark/test/multiple_ranges_test.cc
libcxx/trunk/utils/google-benchmark/test/reporter_output_test.cc

Modified: libcxx/trunk/utils/google-benchmark/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/utils/google-benchmark/CMakeLists.txt?rev=279989=279988=279989=diff
==
--- libcxx/trunk/utils/google-benchmark/CMakeLists.txt (original)
+++ libcxx/trunk/utils/google-benchmark/CMakeLists.txt Mon Aug 29 14:12:01 2016
@@ -12,6 +12,7 @@ endforeach()
 
 option(BENCHMARK_ENABLE_TESTING "Enable testing of the benchmark library." ON)
 option(BENCHMARK_ENABLE_LTO "Enable link time optimisation of the benchmark 
library." OFF)
+option(BENCHMARK_USE_LIBCXX "Build and test using libc++ as the standard 
library." OFF)
 # Make sure we can import out CMake functions
 list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
 
@@ -78,8 +79,10 @@ else()
   add_cxx_compiler_flag(-pedantic-errors)
   add_cxx_compiler_flag(-Wshorten-64-to-32)
   add_cxx_compiler_flag(-Wfloat-equal)
-  add_cxx_compiler_flag(-Wzero-as-null-pointer-constant)
   add_cxx_compiler_flag(-fstrict-aliasing)
+  if (NOT BENCHMARK_USE_LIBCXX)
+add_cxx_compiler_flag(-Wzero-as-null-pointer-constant)
+  endif()
   if (HAVE_CXX_FLAG_FSTRICT_ALIASING)
 add_cxx_compiler_flag(-Wstrict-aliasing)
   endif()
@@ -126,6 +129,24 @@ else()
   add_cxx_compiler_flag(--coverage COVERAGE)
 endif()
 
+if (BENCHMARK_USE_LIBCXX)
+  if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+add_cxx_compiler_flag(-stdlib=libc++)
+  elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR
+  "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
+add_cxx_compiler_flag(-nostdinc++)
+message("libc++ header path must be manually specified using 
CMAKE_CXX_FLAGS")
+# Adding -nodefaultlibs directly to CMAKE__LINKER_FLAGS will break
+# configuration checks such as 'find_package(Threads)'
+list(APPEND BENCHMARK_CXX_LINKER_FLAGS -nodefaultlibs)
+# -lc++ cannot be added directly to CMAKE__LINKER_FLAGS because
+# linker flags appear before all linker inputs and -lc++ must appear after.
+list(APPEND BENCHMARK_CXX_LIBRARIES c++)
+  else()
+message(FATAL "-DBENCHMARK_USE_LIBCXX:BOOL=ON is not supported for 
compiler")
+  endif()
+endif(BENCHMARK_USE_LIBCXX)
+
 # C++ feature checks
 cxx_feature_check(STD_REGEX)
 cxx_feature_check(GNU_POSIX_REGEX)

Modified: libcxx/trunk/utils/google-benchmark/README.md
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/utils/google-benchmark/README.md?rev=279989=279988=279989=diff
==
--- libcxx/trunk/utils/google-benchmark/README.md (original)
+++ libcxx/trunk/utils/google-benchmark/README.md Mon Aug 29 14:12:01 2016
@@ -391,6 +391,13 @@ The number of runs of each benchmark is
 `Repetitions` on the registered benchmark object. When a benchmark is run
 more than once the mean and standard deviation of the runs will be reported.
 
+Additionally the `--benchmark_report_aggregates_only={true|false}` flag or
+`ReportAggregatesOnly(bool)` function can be used to change how repeated tests
+are reported. By default the result of each repeated run is reported. When this
+option is 'true' only the mean and standard deviation of the runs is reported.
+Calling `ReportAggregatesOnly(bool)` on a registered benchmark object overrides
+the value of the flag for that benchmark.
+
 ## Fixtures
 Fixture tests are created by
 first defining a type that derives from ::benchmark::Fixture and then

Modified: libcxx/trunk/utils/google-benchmark/cmake/CXXFeatureCheck.cmake
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/utils/google-benchmark/cmake/CXXFeatureCheck.cmake?rev=279989=279988=279989=diff
==
--- libcxx/trunk/utils/google-benchmark/cmake/CXXFeatureCheck.cmake (original)
+++ 

Re: [PATCH] D23856: [libc++] Perform configuration checks with -nodefaultlibs

2016-08-29 Thread Eric Fiselier via cfe-commits
EricWF added inline comments.


Comment at: cmake/config-ix.cmake:18
@@ +17,3 @@
+if (LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG)
+  list(APPEND CMAKE_REQUIRED_LIBRARIES -nodefaultlibs)
+  if (LIBCXX_HAS_C_LIB)

smeenai wrote:
> smeenai wrote:
> > compnerd wrote:
> > > Can we not use `CMAKE_SHARED_LINKER_FLAGS` instead of 
> > > `CMAKE_REQUIRED_LIBRARIES`?  It is slightly misleading.
> > That would pollute everything building a shared library, whereas this 
> > limits it to only configuration checks. I know it's misleading, but I view 
> > it similar to how `target_link_libraries` is also used for specifying 
> > linker flags.
> > 
> > Speaking of pollution though, my `REQUIRED_*` changes in this file will end 
> > up affecting other projects for non-standalone builds, correct? What's the 
> > best way to limit this to be libc++-only?
> Never mind. cmake automatically limits variables to the scope of the current 
> directory, so this shouldn't pollute anything outside of libc++.
> 
> This should be good to review.
`CMAKE_REQUIRED_LIBRARIES` should still only really be used for libraries. I 
think `CMAKE_REQUIRED_FLAGS` would be a better place to put this, if not 
`CMAKE_SHARED_LINKER_FLAGS`.


https://reviews.llvm.org/D23856



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


Re: [PATCH] D23856: [libc++] Perform configuration checks with -nodefaultlibs

2016-08-29 Thread Shoaib Meenai via cfe-commits
smeenai marked an inline comment as done.


Comment at: cmake/config-ix.cmake:18
@@ +17,3 @@
+if (LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG)
+  list(APPEND CMAKE_REQUIRED_LIBRARIES -nodefaultlibs)
+  if (LIBCXX_HAS_C_LIB)

smeenai wrote:
> compnerd wrote:
> > Can we not use `CMAKE_SHARED_LINKER_FLAGS` instead of 
> > `CMAKE_REQUIRED_LIBRARIES`?  It is slightly misleading.
> That would pollute everything building a shared library, whereas this limits 
> it to only configuration checks. I know it's misleading, but I view it 
> similar to how `target_link_libraries` is also used for specifying linker 
> flags.
> 
> Speaking of pollution though, my `REQUIRED_*` changes in this file will end 
> up affecting other projects for non-standalone builds, correct? What's the 
> best way to limit this to be libc++-only?
Never mind. cmake automatically limits variables to the scope of the current 
directory, so this shouldn't pollute anything outside of libc++.

This should be good to review.


https://reviews.llvm.org/D23856



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


Re: [PATCH] D16989: Change interpretation of function definition in friend declaration of template class.

2016-08-29 Thread Serge Pavlov via cfe-commits
sepavloff updated this revision to Diff 69595.
sepavloff added a comment.

Updated patch

Added missing checks for forward declarations in 
`shouldLinkDependentDeclWithPrevious`.
Added test case from an ancient bug report.


https://reviews.llvm.org/D16989

Files:
  include/clang/Sema/Sema.h
  lib/Sema/SemaDecl.cpp
  test/SemaCXX/PR25848.cpp
  test/SemaCXX/friend2.cpp

Index: test/SemaCXX/friend2.cpp
===
--- /dev/null
+++ test/SemaCXX/friend2.cpp
@@ -0,0 +1,162 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11
+
+// If a friend function is defined in several non-template classes,
+// it is an error.
+
+void func1(int);
+struct C1a {
+  friend void func1(int) {}  // expected-note{{previous definition is here}}
+};
+struct C1b {
+  friend void func1(int) {}  // expected-error{{redefinition of 'func1'}}
+};
+
+
+// If a friend function is defined in both non-template and template
+// classes it is an error only if the template is instantiated.
+
+void func2(int);
+struct C2a {
+  friend void func2(int) {}
+};
+template struct C2b {
+  friend void func2(int) {}
+};
+
+void func3(int);
+struct C3a {
+  friend void func3(int) {}  // expected-note{{previous definition is here}}
+};
+template struct C3b {
+  friend void func3(int) {}  // expected-error{{redefinition of 'func3'}}
+};
+C3b c3;  // expected-note{{in instantiation of template class 'C3b' requested here}}
+
+
+// If a friend function is defined in several template classes it is an error
+// only if several templates are instantiated.
+
+void func4(int);
+template struct C4a {
+  friend void func4(int) {}
+};
+template struct C4b {
+  friend void func4(int) {}
+};
+
+
+void func5(int);
+template struct C5a {
+  friend void func5(int) {}
+};
+template struct C5b {
+  friend void func5(int) {}
+};
+C5a c5a;
+
+void func6(int);
+template struct C6a {
+  friend void func6(int) {}  // expected-note{{previous definition is here}}
+};
+template struct C6b {
+  friend void func6(int) {}  // expected-error{{redefinition of 'func6'}}
+};
+C6a c6a;
+C6b c6b;  // expected-note{{in instantiation of template class 'C6b' requested here}}
+
+void func7(int);
+template struct C7 {
+  friend void func7(int) {}  // expected-error{{redefinition of 'func7'}}
+ // expected-note@-1{{previous definition is here}}
+};
+C7 c7a;
+C7 c7b;  // expected-note{{in instantiation of template class 'C7' requested here}}
+
+
+// Even if clases are not instantiated and hence friend functions defined in them are not
+// available, their declarations can be checked.
+
+void func8(int);  // expected-note{{previous declaration is here}}
+template struct C8a {
+  friend long func8(int);  // expected-error{{functions that differ only in their return type cannot be overloaded}}
+};
+
+void func9(int);  // expected-note{{previous declaration is here}}
+template struct C9a {
+  friend int func9(int);  // expected-error{{functions that differ only in their return type cannot be overloaded}}
+};
+
+void func10(int);  // expected-note{{previous declaration is here}}
+template struct C10a {
+  friend int func10(int);  // expected-error{{functions that differ only in their return type cannot be overloaded}}
+};
+
+
+namespace pr22307 {
+
+struct t {
+  friend int leak(t);
+};
+
+template
+struct m {
+  friend int leak(t) { return sizeof(v); }  // expected-error{{redefinition of 'leak'}} expected-note{{previous definition is here}}
+};
+
+template struct m;
+template struct m;  // expected-note{{in instantiation of template class 'pr22307::m' requested here}}
+
+int main() {
+  leak(t());
+}
+
+}
+
+namespace pr17923 {
+
+void f(unsigned long long);
+
+template struct X {
+  friend void f(unsigned long long) {
+ T t;
+  }
+};
+
+int main() { f(1234); }
+
+}
+
+namespace pr17923a {
+
+int get();
+
+template< int value >
+class set {
+  friend int get()
+{ return value; } // return 0; is OK
+};
+
+template class set< 5 >;
+
+int main() {
+  get();
+}
+
+}
+
+namespace pr8035 {
+
+void Function();
+
+int main(int argc, char* argv[]) {
+  Function();
+}
+
+template 
+struct Test {
+  friend void Function() { }
+};
+
+template class Test;
+
+}
Index: test/SemaCXX/PR25848.cpp
===
--- /dev/null
+++ test/SemaCXX/PR25848.cpp
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+struct A;
+
+inline int g();  // expected-warning{{inline function 'g' is not defined}}
+
+template
+struct R {
+  friend int g() {
+return M;
+  }
+};
+
+void m() {
+  g();  // expected-note{{used here}}
+}
Index: lib/Sema/SemaDecl.cpp
===
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -8640,6 +8640,58 @@
   return NewFD;
 }
 
+/// \brief Checks if the new declaration declared in dependent context must be
+/// put in the same redeclaration chain as the specified 

Re: [PATCH] D16989: Change interpretation of function definition in friend declaration of template class.

2016-08-29 Thread Serge Pavlov via cfe-commits
sepavloff marked an inline comment as done.


Comment at: lib/Sema/SemaDecl.cpp:8657-8658
@@ +8656,4 @@
+  DeclContext *SemanticDC = D->getDeclContext();
+  if (SemanticDC->isDependentContext())
+return false;
+  // Get here only for out-of-line declarations: lexical context is dependent,

rsmith wrote:
> I don't think this is right. Given:
> 
>   template void f() {
> extern void g();
> extern void g();
>   }
> 
> ... we do want to link the two declarations of `g` together. We even want to 
> link them to a prior declaration of `::g` if there is one, since they have a 
> non-dependent type, otherwise we'll reject cases like:
> 
>   void g();
>   constexpr void (*p)() = g;
>   template struct X { typedef int type; };
>   template void f() {
> extern void g();
> X< == p>::type n; // note: no 'typename' required, not value-dependent,
>   } // must evaluate to 'true' while parsing the template
> 
> Perhaps we're trying to make this check too general, and we should instead 
> only make this new logic apply to the case of friend declarations. Are there 
> any cases where a friend declaration in a dependent context that names a 
> non-member function needs to be added to the redeclaration chain?
It is convenient to have single function for both friend and forward 
declarations, as it is called from the point where both cases may be observed.

It looks like there is no mandatory requirement to add a friend declaration in 
a dependent context to the redeclaration chain, because ill-formed program will 
be detected during instantiation of enclosing template class. But making so 
allows to detect some problems earlier.


https://reviews.llvm.org/D16989



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


Re: [PATCH] D23918: [clang-tidy docs] Add missing option docs.

2016-08-29 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added inline comments.


Comment at: docs/clang-tidy/checks/google-runtime-int.rst:27
@@ +26,2 @@
+
+   A string represents type suffix. Default is empty.

I think empty string will be better. Same for other occurrences.


https://reviews.llvm.org/D23918



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


Re: [PATCH] D23987: [Coverage] Suppress creating a code region if the same area is covered by an expansion region.

2016-08-29 Thread Vedant Kumar via cfe-commits
vsk added a comment.

Thanks for looking into this! I like the SourceRegionFilter setup.



Comment at: lib/CodeGen/CoverageMappingGen.cpp:261
@@ -253,1 +260,3 @@
+  void
+  emitSourceRegions(const SourceRegionFilter  = SourceRegionFilter()) {
 for (const auto  : SourceRegions) {

Nit, is the default value needed?


Comment at: lib/CodeGen/CoverageMappingGen.cpp:634
@@ -610,1 +633,3 @@
+  return LHS.Kind < RHS.Kind;
+});
 gatherSkippedRegions();

Out of curiosity, is this stable_sort step required for correctness? Or would 
our CHECK lines break without this?

In either case, would it be feasible to merge this step with the stable_sort in 
CoverageMappingWriter::write()?


https://reviews.llvm.org/D23987



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


Re: [libcxxabi] r279938 - [CMake] Be more consistent about naming targets and components in libc++abi

2016-08-29 Thread Chris Bieneman via cfe-commits
And I just noticed your other commit, which I think means you did all the work 
there.

Many thanks!
-Chris

> On Aug 29, 2016, at 11:09 AM, Chris Bieneman via cfe-commits 
>  wrote:
> 
> Many thanks for taking this on. I haven’t yet had a chance to look into 
> libcxxabi, but it is next on my list of projects to get into the runtimes 
> subdirectory.
> 
> Thanks!
> -Chris
> 
>> On Aug 28, 2016, at 11:28 AM, Eric Fiselier via cfe-commits 
>>  wrote:
>> 
>> Author: ericwf
>> Date: Sun Aug 28 13:28:51 2016
>> New Revision: 279938
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=279938=rev
>> Log:
>> [CMake] Be more consistent about naming targets and components in libc++abi
>> 
>> This patch (and commit summary) mirror r279675 by Chris B which was applied
>> to libc++ but not libc++abi.
>> 
>> Summary:
>> The point of this patch is to have a consistent convention for naming build,
>> check and install targets so that the targets can be constructed from the
>> project name.
>> 
>> This change renames a bunch of CMake components and targets from libcxxabi to
>> cxxabi. For each renamed target I've added a convenience target that matches
>> the old target name and depends on the new target. This will preserve 
>> function
>> of the old targets so that the change doesn't break the world. We can 
>> evaluate
>> if it is worth removing the extra targets later.
>> 
>> Modified:
>>   libcxxabi/trunk/src/CMakeLists.txt
>>   libcxxabi/trunk/test/CMakeLists.txt
>>   libcxxabi/trunk/www/index.html
>> 
>> Modified: libcxxabi/trunk/src/CMakeLists.txt
>> URL: 
>> http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/CMakeLists.txt?rev=279938=279937=279938=diff
>> ==
>> --- libcxxabi/trunk/src/CMakeLists.txt (original)
>> +++ libcxxabi/trunk/src/CMakeLists.txt Sun Aug 28 13:28:51 2016
>> @@ -134,14 +134,17 @@ endif()
>> add_custom_target(cxxabi DEPENDS ${LIBCXXABI_TARGETS})
>> 
>> install(TARGETS ${LIBCXXABI_TARGETS}
>> -  LIBRARY DESTINATION lib${LIBCXXABI_LIBDIR_SUFFIX} COMPONENT libcxxabi
>> -  ARCHIVE DESTINATION lib${LIBCXXABI_LIBDIR_SUFFIX} COMPONENT libcxxabi
>> +  LIBRARY DESTINATION lib${LIBCXXABI_LIBDIR_SUFFIX} COMPONENT cxxabi
>> +  ARCHIVE DESTINATION lib${LIBCXXABI_LIBDIR_SUFFIX} COMPONENT cxxabi
>>  )
>> 
>> if (NOT CMAKE_CONFIGURATION_TYPES)
>> -  add_custom_target(install-libcxxabi
>> +  add_custom_target(install-cxxabi
>>DEPENDS cxxabi
>>COMMAND "${CMAKE_COMMAND}"
>> --DCMAKE_INSTALL_COMPONENT=libcxxabi
>> +-DCMAKE_INSTALL_COMPONENT=cxxabi
>>-P "${LIBCXXABI_BINARY_DIR}/cmake_install.cmake")
>> +
>> +  # TODO: This is a legacy target name and should be removed at some point.
>> +  add_custom_target(install-libcxxabi DEPENDS install-cxxabi)
>> endif()
>> 
>> Modified: libcxxabi/trunk/test/CMakeLists.txt
>> URL: 
>> http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/CMakeLists.txt?rev=279938=279937=279938=diff
>> ==
>> --- libcxxabi/trunk/test/CMakeLists.txt (original)
>> +++ libcxxabi/trunk/test/CMakeLists.txt Sun Aug 28 13:28:51 2016
>> @@ -42,7 +42,10 @@ if (NOT LIBCXXABI_STANDALONE_BUILD)
>>  endif()
>> endif()
>> 
>> -add_lit_testsuite(check-libcxxabi "Running libcxxabi tests"
>> +add_lit_testsuite(check-cxxabi "Running libcxxabi tests"
>>  ${CMAKE_CURRENT_BINARY_DIR}
>>  DEPENDS ${LIBCXXABI_TEST_DEPS}
>>  )
>> +
>> +# TODO: This is a legacy target name and should be removed at some point.
>> +add_custom_target(check-libcxxabi DEPENDS check-cxxabi)
>> 
>> Modified: libcxxabi/trunk/www/index.html
>> URL: 
>> http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/www/index.html?rev=279938=279937=279938=diff
>> ==
>> --- libcxxabi/trunk/www/index.html (original)
>> +++ libcxxabi/trunk/www/index.html Sun Aug 28 13:28:51 2016
>> @@ -112,7 +112,7 @@
>> 
>>  To run the tests:
>>  
>> -  make check-libcxxabi
>> +  make check-cxxabi
>>  
>>  Note: in a standalone build, the system's libc++ will be used for tests. 
>> If
>>  the system's libc++ was statically linked against libc++abi (or linked 
>> against
>> 
>> 
>> ___
>> 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: [libcxxabi] r279938 - [CMake] Be more consistent about naming targets and components in libc++abi

2016-08-29 Thread Chris Bieneman via cfe-commits
Many thanks for taking this on. I haven’t yet had a chance to look into 
libcxxabi, but it is next on my list of projects to get into the runtimes 
subdirectory.

Thanks!
-Chris

> On Aug 28, 2016, at 11:28 AM, Eric Fiselier via cfe-commits 
>  wrote:
> 
> Author: ericwf
> Date: Sun Aug 28 13:28:51 2016
> New Revision: 279938
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=279938=rev
> Log:
> [CMake] Be more consistent about naming targets and components in libc++abi
> 
> This patch (and commit summary) mirror r279675 by Chris B which was applied
> to libc++ but not libc++abi.
> 
> Summary:
> The point of this patch is to have a consistent convention for naming build,
> check and install targets so that the targets can be constructed from the
> project name.
> 
> This change renames a bunch of CMake components and targets from libcxxabi to
> cxxabi. For each renamed target I've added a convenience target that matches
> the old target name and depends on the new target. This will preserve function
> of the old targets so that the change doesn't break the world. We can evaluate
> if it is worth removing the extra targets later.
> 
> Modified:
>libcxxabi/trunk/src/CMakeLists.txt
>libcxxabi/trunk/test/CMakeLists.txt
>libcxxabi/trunk/www/index.html
> 
> Modified: libcxxabi/trunk/src/CMakeLists.txt
> URL: 
> http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/CMakeLists.txt?rev=279938=279937=279938=diff
> ==
> --- libcxxabi/trunk/src/CMakeLists.txt (original)
> +++ libcxxabi/trunk/src/CMakeLists.txt Sun Aug 28 13:28:51 2016
> @@ -134,14 +134,17 @@ endif()
> add_custom_target(cxxabi DEPENDS ${LIBCXXABI_TARGETS})
> 
> install(TARGETS ${LIBCXXABI_TARGETS}
> -  LIBRARY DESTINATION lib${LIBCXXABI_LIBDIR_SUFFIX} COMPONENT libcxxabi
> -  ARCHIVE DESTINATION lib${LIBCXXABI_LIBDIR_SUFFIX} COMPONENT libcxxabi
> +  LIBRARY DESTINATION lib${LIBCXXABI_LIBDIR_SUFFIX} COMPONENT cxxabi
> +  ARCHIVE DESTINATION lib${LIBCXXABI_LIBDIR_SUFFIX} COMPONENT cxxabi
>   )
> 
> if (NOT CMAKE_CONFIGURATION_TYPES)
> -  add_custom_target(install-libcxxabi
> +  add_custom_target(install-cxxabi
> DEPENDS cxxabi
> COMMAND "${CMAKE_COMMAND}"
> --DCMAKE_INSTALL_COMPONENT=libcxxabi
> +-DCMAKE_INSTALL_COMPONENT=cxxabi
> -P "${LIBCXXABI_BINARY_DIR}/cmake_install.cmake")
> +
> +  # TODO: This is a legacy target name and should be removed at some point.
> +  add_custom_target(install-libcxxabi DEPENDS install-cxxabi)
> endif()
> 
> Modified: libcxxabi/trunk/test/CMakeLists.txt
> URL: 
> http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/CMakeLists.txt?rev=279938=279937=279938=diff
> ==
> --- libcxxabi/trunk/test/CMakeLists.txt (original)
> +++ libcxxabi/trunk/test/CMakeLists.txt Sun Aug 28 13:28:51 2016
> @@ -42,7 +42,10 @@ if (NOT LIBCXXABI_STANDALONE_BUILD)
>   endif()
> endif()
> 
> -add_lit_testsuite(check-libcxxabi "Running libcxxabi tests"
> +add_lit_testsuite(check-cxxabi "Running libcxxabi tests"
>   ${CMAKE_CURRENT_BINARY_DIR}
>   DEPENDS ${LIBCXXABI_TEST_DEPS}
>   )
> +
> +# TODO: This is a legacy target name and should be removed at some point.
> +add_custom_target(check-libcxxabi DEPENDS check-cxxabi)
> 
> Modified: libcxxabi/trunk/www/index.html
> URL: 
> http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/www/index.html?rev=279938=279937=279938=diff
> ==
> --- libcxxabi/trunk/www/index.html (original)
> +++ libcxxabi/trunk/www/index.html Sun Aug 28 13:28:51 2016
> @@ -112,7 +112,7 @@
> 
>   To run the tests:
>   
> -  make check-libcxxabi
> +  make check-cxxabi
>   
>   Note: in a standalone build, the system's libc++ will be used for tests. 
> If
>   the system's libc++ was statically linked against libc++abi (or linked 
> against
> 
> 
> ___
> 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] D23895: [ms] Add support for parsing uuid as a MS attribute

2016-08-29 Thread Reid Kleckner via cfe-commits
rnk added a comment.

The code looks good and I'm happy to leave the naming as it is for now. 
Apparently MSVC is warning on these attributes and calling them "ATL 
attributes" now: https://msdn.microsoft.com/en-us/library/mt723604.aspx I'm not 
sure if that warning applies to all square-bracketed user defined attributes or 
not, but the naming is certainly confusing.

Even though this change doesn't change the behavior of the parser, I would feel 
more comfortable if we added a new test at 
test/SemaCXX/ms-square-bracket-attributes.cpp or something that exhaustively 
lists the ambiguities we know about and codifies how we diagnose them. That 
way, if someone accidentally changes behavior in this area, we'll know about 
it. This seems like a good starting point for the test:

  void local_class() {
// FIXME: MSVC accepts, but we reject due to ambiguity.
// expected-error@+1 {{expected body of lambda expression}}
[uuid("a5a7bd07-3b14-49bc-9399-de066d4d72cd")] struct Local {
  int x;
};
  }
  
  void useit(int);
  
  int lambda() {
int uuid = 42;
[uuid]() {
  useit(uuid);
}();
  }


https://reviews.llvm.org/D23895



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


Re: [PATCH] D23944: Parsing MS pragma intrinsic

2016-08-29 Thread Reid Kleckner via cfe-commits
rnk added inline comments.


Comment at: include/clang/Basic/DiagnosticParseKinds.td:916
@@ +915,3 @@
+def warn_pragma_expected_builtin : Warning<
+  "expected builtin function in '#pragma %0' - ignored">,
+  InGroup;

I'd use this wording:
  '%0' is not a recognized builtin


Comment at: include/clang/Basic/DiagnosticParseKinds.td:919
@@ -914,1 +918,3 @@
+def note_pragma_intrinsic_intrin_header : Note<
+  "consider including  to access the non-builtin intrinsics">;
 // - #pragma unused

Generally notes are attached to other source locations, which we don't have in 
this case. I'd replace this note with a second diagnostic with an extra clause:
  def warn_pragma_intrinsic_builtin_suggest : Warning<
"'%0' is not a recognized builtin; consider including  to access 
non-builtin intrinsics">;

If you search for "suggest" in the diagnostic file, you can see other instances 
of this.


https://reviews.llvm.org/D23944



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


Re: [PATCH] D23895: [ms] Add support for parsing uuid as a MS attribute

2016-08-29 Thread Nico Weber via cfe-commits
thakis added a comment.

rnk: ping


https://reviews.llvm.org/D23895



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


Re: r279765 - Omit column info for CodeView by default

2016-08-29 Thread David Blaikie via cfe-commits
ah, fair enough - only saw the diff, not the rest of the file

On Mon, Aug 29, 2016 at 9:59 AM Adrian McCarthy  wrote:

> Thanks.  I was trying to be consistent with how the prefixes were used in
> this particular file, where the prefix was modeled after the case-sensitive
> flags being tested.
>
> On Mon, Aug 29, 2016 at 8:49 AM, David Blaikie  wrote:
>
>>
>>
>> On Thu, Aug 25, 2016 at 11:32 AM Adrian McCarthy via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>> Author: amccarth
>>> Date: Thu Aug 25 13:24:35 2016
>>> New Revision: 279765
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=279765=rev
>>> Log:
>>> Omit column info for CodeView by default
>>>
>>> Clang tracks only start columns, not start-end ranges. CodeView allows
>>> for that, but the VS debugger doesn't handle anything less than a complete
>>> range well--it either highlights the wrong part of a statement or truncates
>>> source lines in the assembly view. It's better to have no column
>>> information at all.
>>>
>>> So by default, we'll omit the column information for CodeView targeting
>>> Windows.
>>>
>>> Since the column info is still useful for sanitizers, I've promoted
>>> -gcolumn-info (and -gno-column-info) to a CoreOption and added a couple
>>> tests to make sure that works for clang-cl.
>>>
>>> Differential Revision: https://reviews.llvm.org/D23720
>>>
>>> Modified:
>>> cfe/trunk/include/clang/Driver/Options.td
>>> cfe/trunk/lib/Driver/Tools.cpp
>>> cfe/trunk/test/Driver/cl-options.c
>>>
>>> Modified: cfe/trunk/include/clang/Driver/Options.td
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=279765=279764=279765=diff
>>>
>>> ==
>>> --- cfe/trunk/include/clang/Driver/Options.td (original)
>>> +++ cfe/trunk/include/clang/Driver/Options.td Thu Aug 25 13:24:35 2016
>>> @@ -1305,8 +1305,8 @@ def gno_record_gcc_switches : Flag<["-"]
>>>Group;
>>>  def gstrict_dwarf : Flag<["-"], "gstrict-dwarf">, Group;
>>>  def gno_strict_dwarf : Flag<["-"], "gno-strict-dwarf">,
>>> Group;
>>> -def gcolumn_info : Flag<["-"], "gcolumn-info">, Group;
>>> -def gno_column_info : Flag<["-"], "gno-column-info">,
>>> Group;
>>> +def gcolumn_info : Flag<["-"], "gcolumn-info">, Group,
>>> Flags<[CoreOption]>;
>>> +def gno_column_info : Flag<["-"], "gno-column-info">,
>>> Group, Flags<[CoreOption]>;
>>>  def gsplit_dwarf : Flag<["-"], "gsplit-dwarf">, Group;
>>>  def ggnu_pubnames : Flag<["-"], "ggnu-pubnames">, Group;
>>>  def gdwarf_aranges : Flag<["-"], "gdwarf-aranges">,
>>> Group;
>>>
>>> Modified: cfe/trunk/lib/Driver/Tools.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=279765=279764=279765=diff
>>>
>>> ==
>>> --- cfe/trunk/lib/Driver/Tools.cpp (original)
>>> +++ cfe/trunk/lib/Driver/Tools.cpp Thu Aug 25 13:24:35 2016
>>> @@ -2574,7 +2574,7 @@ static void getTargetFeatures(const Tool
>>>case llvm::Triple::wasm32:
>>>case llvm::Triple::wasm64:
>>>  getWebAssemblyTargetFeatures(Args, Features);
>>> -break;
>>> +break;
>>>case llvm::Triple::sparc:
>>>case llvm::Triple::sparcel:
>>>case llvm::Triple::sparcv9:
>>> @@ -4656,9 +4656,13 @@ void Clang::ConstructJob(Compilation ,
>>>// We ignore flags -gstrict-dwarf and -grecord-gcc-switches for now.
>>>Args.ClaimAllArgs(options::OPT_g_flags_Group);
>>>
>>> -  // PS4 defaults to no column info
>>> +  // Column info is included by default for everything except PS4 and
>>> CodeView.
>>> +  // Clang doesn't track end columns, just starting columns, which, in
>>> theory,
>>> +  // is fine for CodeView (and PDB).  In practice, however, the
>>> Microsoft
>>> +  // debuggers don't handle missing end columns well, so it's better
>>> not to
>>> +  // include any column info.
>>>if (Args.hasFlag(options::OPT_gcolumn_info,
>>> options::OPT_gno_column_info,
>>> -   /*Default=*/ !IsPS4CPU))
>>> +   /*Default=*/ !IsPS4CPU && !(IsWindowsMSVC &&
>>> EmitCodeView)))
>>>  CmdArgs.push_back("-dwarf-column-info");
>>>
>>>// FIXME: Move backend command line options to the module.
>>> @@ -6712,7 +6716,7 @@ void ClangAs::ConstructJob(Compilation &
>>>case llvm::Triple::mips64el:
>>>  AddMIPSTargetArgs(Args, CmdArgs);
>>>  break;
>>> -
>>> +
>>>case llvm::Triple::x86:
>>>case llvm::Triple::x86_64:
>>>  AddX86TargetArgs(Args, CmdArgs);
>>>
>>> Modified: cfe/trunk/test/Driver/cl-options.c
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-options.c?rev=279765=279764=279765=diff
>>>
>>> ==
>>> --- cfe/trunk/test/Driver/cl-options.c (original)
>>> +++ cfe/trunk/test/Driver/cl-options.c Thu Aug 25 13:24:35 2016
>>> @@ -50,6 +50,15 @@
>>> 

Re: r279765 - Omit column info for CodeView by default

2016-08-29 Thread Adrian McCarthy via cfe-commits
Thanks.  I was trying to be consistent with how the prefixes were used in
this particular file, where the prefix was modeled after the case-sensitive
flags being tested.

On Mon, Aug 29, 2016 at 8:49 AM, David Blaikie  wrote:

>
>
> On Thu, Aug 25, 2016 at 11:32 AM Adrian McCarthy via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: amccarth
>> Date: Thu Aug 25 13:24:35 2016
>> New Revision: 279765
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=279765=rev
>> Log:
>> Omit column info for CodeView by default
>>
>> Clang tracks only start columns, not start-end ranges. CodeView allows
>> for that, but the VS debugger doesn't handle anything less than a complete
>> range well--it either highlights the wrong part of a statement or truncates
>> source lines in the assembly view. It's better to have no column
>> information at all.
>>
>> So by default, we'll omit the column information for CodeView targeting
>> Windows.
>>
>> Since the column info is still useful for sanitizers, I've promoted
>> -gcolumn-info (and -gno-column-info) to a CoreOption and added a couple
>> tests to make sure that works for clang-cl.
>>
>> Differential Revision: https://reviews.llvm.org/D23720
>>
>> Modified:
>> cfe/trunk/include/clang/Driver/Options.td
>> cfe/trunk/lib/Driver/Tools.cpp
>> cfe/trunk/test/Driver/cl-options.c
>>
>> Modified: cfe/trunk/include/clang/Driver/Options.td
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/
>> clang/Driver/Options.td?rev=279765=279764=279765=diff
>> 
>> ==
>> --- cfe/trunk/include/clang/Driver/Options.td (original)
>> +++ cfe/trunk/include/clang/Driver/Options.td Thu Aug 25 13:24:35 2016
>> @@ -1305,8 +1305,8 @@ def gno_record_gcc_switches : Flag<["-"]
>>Group;
>>  def gstrict_dwarf : Flag<["-"], "gstrict-dwarf">, Group;
>>  def gno_strict_dwarf : Flag<["-"], "gno-strict-dwarf">,
>> Group;
>> -def gcolumn_info : Flag<["-"], "gcolumn-info">, Group;
>> -def gno_column_info : Flag<["-"], "gno-column-info">,
>> Group;
>> +def gcolumn_info : Flag<["-"], "gcolumn-info">, Group,
>> Flags<[CoreOption]>;
>> +def gno_column_info : Flag<["-"], "gno-column-info">,
>> Group, Flags<[CoreOption]>;
>>  def gsplit_dwarf : Flag<["-"], "gsplit-dwarf">, Group;
>>  def ggnu_pubnames : Flag<["-"], "ggnu-pubnames">, Group;
>>  def gdwarf_aranges : Flag<["-"], "gdwarf-aranges">, Group;
>>
>> Modified: cfe/trunk/lib/Driver/Tools.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/
>> Tools.cpp?rev=279765=279764=279765=diff
>> 
>> ==
>> --- cfe/trunk/lib/Driver/Tools.cpp (original)
>> +++ cfe/trunk/lib/Driver/Tools.cpp Thu Aug 25 13:24:35 2016
>> @@ -2574,7 +2574,7 @@ static void getTargetFeatures(const Tool
>>case llvm::Triple::wasm32:
>>case llvm::Triple::wasm64:
>>  getWebAssemblyTargetFeatures(Args, Features);
>> -break;
>> +break;
>>case llvm::Triple::sparc:
>>case llvm::Triple::sparcel:
>>case llvm::Triple::sparcv9:
>> @@ -4656,9 +4656,13 @@ void Clang::ConstructJob(Compilation ,
>>// We ignore flags -gstrict-dwarf and -grecord-gcc-switches for now.
>>Args.ClaimAllArgs(options::OPT_g_flags_Group);
>>
>> -  // PS4 defaults to no column info
>> +  // Column info is included by default for everything except PS4 and
>> CodeView.
>> +  // Clang doesn't track end columns, just starting columns, which, in
>> theory,
>> +  // is fine for CodeView (and PDB).  In practice, however, the Microsoft
>> +  // debuggers don't handle missing end columns well, so it's better not
>> to
>> +  // include any column info.
>>if (Args.hasFlag(options::OPT_gcolumn_info,
>> options::OPT_gno_column_info,
>> -   /*Default=*/ !IsPS4CPU))
>> +   /*Default=*/ !IsPS4CPU && !(IsWindowsMSVC &&
>> EmitCodeView)))
>>  CmdArgs.push_back("-dwarf-column-info");
>>
>>// FIXME: Move backend command line options to the module.
>> @@ -6712,7 +6716,7 @@ void ClangAs::ConstructJob(Compilation &
>>case llvm::Triple::mips64el:
>>  AddMIPSTargetArgs(Args, CmdArgs);
>>  break;
>> -
>> +
>>case llvm::Triple::x86:
>>case llvm::Triple::x86_64:
>>  AddX86TargetArgs(Args, CmdArgs);
>>
>> Modified: cfe/trunk/test/Driver/cl-options.c
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/
>> cl-options.c?rev=279765=279764=279765=diff
>> 
>> ==
>> --- cfe/trunk/test/Driver/cl-options.c (original)
>> +++ cfe/trunk/test/Driver/cl-options.c Thu Aug 25 13:24:35 2016
>> @@ -50,6 +50,15 @@
>>  // fpstrict-NOT: -menable-unsafe-fp-math
>>  // fpstrict-NOT: -ffast-math
>>
>> +// RUN: %clang_cl /Z7 -gcolumn-info -### -- %s 2>&1 | FileCheck
>> -check-prefix=gcolumn %s
>> +// gcolumn: -dwarf-column-info
>> +
>> +// RUN: %clang_cl /Z7 -gno-column-info -### -- 

Re: [PATCH] D23848: Add a clang-tidy Visual Studio extension

2016-08-29 Thread Zachary Turner via cfe-commits
zturner added a comment.

Anyone else have any thoughts on this or is this good to go?


https://reviews.llvm.org/D23848



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


Re: [PATCH] D23375: Add kfree( ) to MallocChecker.cpp

2016-08-29 Thread Devin Coughlin via cfe-commits
dcoughlin added a comment.

In https://reviews.llvm.org/D23375#527291, @andrewmw94 wrote:

> One more thing, obviously it should mimic malloc/free's behavior in 
> complaining about delete/new being used.  Should it also complain about 
> free/malloc being used?  I can't  imagine that would be something people 
> would usually intend to do, but I don't think it's really "incorrect."  
> Thought?


I'm not familiar with linux kernel programming. Is `free()` available in the 
kernel? If someone did define their own `free()` and used it with `kmalloc`'d 
memory, would they consider this a false positive?


https://reviews.llvm.org/D23375



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


r279978 - Try to fix clang-offload-bunder.c test once more

2016-08-29 Thread Reid Kleckner via cfe-commits
Author: rnk
Date: Mon Aug 29 11:24:57 2016
New Revision: 279978

URL: http://llvm.org/viewvc/llvm-project?rev=279978=rev
Log:
Try to fix clang-offload-bunder.c test once more

Modified:
cfe/trunk/test/Driver/clang-offload-bundler.c

Modified: cfe/trunk/test/Driver/clang-offload-bundler.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/clang-offload-bundler.c?rev=279978=279977=279978=diff
==
--- cfe/trunk/test/Driver/clang-offload-bundler.c (original)
+++ cfe/trunk/test/Driver/clang-offload-bundler.c Mon Aug 29 11:24:57 2016
@@ -230,8 +230,8 @@
 // RUN: clang-offload-bundler -type=o 
-targets=host-powerpc64le-ibm-linux-gnu,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu
 -inputs=%t.o,%t.tgt1,%t.tgt2 -outputs=%t.bundle3.o -### -dump-temporary-files 
2>&1 \
 // RUN: | FileCheck %s --check-prefix CK-OBJ-CMD
 // CK-OBJ-CMD: private constant [1 x i8] zeroinitializer, section 
"__CLANG_OFFLOAD_BUNDLE__host-powerpc64le-ibm-linux-gnu"
-// CK-OBJ-CMD: private constant [25 x i8] c"Content of device file 1{{.+}}", 
section "__CLANG_OFFLOAD_BUNDLE__openmp-powerpc64le-ibm-linux-gnu"
-// CK-OBJ-CMD: private constant [25 x i8] c"Content of device file 2{{.+}}", 
section "__CLANG_OFFLOAD_BUNDLE__openmp-x86_64-pc-linux-gnu"
+// CK-OBJ-CMD: private constant [{{[0-9]+}} x i8] c"Content of device file 
1{{.+}}", section "__CLANG_OFFLOAD_BUNDLE__openmp-powerpc64le-ibm-linux-gnu"
+// CK-OBJ-CMD: private constant [{{[0-9]+}} x i8] c"Content of device file 
2{{.+}}", section "__CLANG_OFFLOAD_BUNDLE__openmp-x86_64-pc-linux-gnu"
 // CK-OBJ-CMD: clang{{(.exe)?}}" "-r" "-target" "powerpc64le-ibm-linux-gnu" 
"-o" "{{.+}}.o" "{{.+}}.o" "{{.+}}.bc" "-nostdlib"
 
 // RUN: clang-offload-bundler -type=o 
-targets=host-powerpc64le-ibm-linux-gnu,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu
 -outputs=%t.res.o,%t.res.tgt1,%t.res.tgt2 -inputs=%s.o -unbundle


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


Re: r279765 - Omit column info for CodeView by default

2016-08-29 Thread David Blaikie via cfe-commits
On Thu, Aug 25, 2016 at 11:32 AM Adrian McCarthy via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: amccarth
> Date: Thu Aug 25 13:24:35 2016
> New Revision: 279765
>
> URL: http://llvm.org/viewvc/llvm-project?rev=279765=rev
> Log:
> Omit column info for CodeView by default
>
> Clang tracks only start columns, not start-end ranges. CodeView allows for
> that, but the VS debugger doesn't handle anything less than a complete
> range well--it either highlights the wrong part of a statement or truncates
> source lines in the assembly view. It's better to have no column
> information at all.
>
> So by default, we'll omit the column information for CodeView targeting
> Windows.
>
> Since the column info is still useful for sanitizers, I've promoted
> -gcolumn-info (and -gno-column-info) to a CoreOption and added a couple
> tests to make sure that works for clang-cl.
>
> Differential Revision: https://reviews.llvm.org/D23720
>
> Modified:
> cfe/trunk/include/clang/Driver/Options.td
> cfe/trunk/lib/Driver/Tools.cpp
> cfe/trunk/test/Driver/cl-options.c
>
> Modified: cfe/trunk/include/clang/Driver/Options.td
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=279765=279764=279765=diff
>
> ==
> --- cfe/trunk/include/clang/Driver/Options.td (original)
> +++ cfe/trunk/include/clang/Driver/Options.td Thu Aug 25 13:24:35 2016
> @@ -1305,8 +1305,8 @@ def gno_record_gcc_switches : Flag<["-"]
>Group;
>  def gstrict_dwarf : Flag<["-"], "gstrict-dwarf">, Group;
>  def gno_strict_dwarf : Flag<["-"], "gno-strict-dwarf">,
> Group;
> -def gcolumn_info : Flag<["-"], "gcolumn-info">, Group;
> -def gno_column_info : Flag<["-"], "gno-column-info">,
> Group;
> +def gcolumn_info : Flag<["-"], "gcolumn-info">, Group,
> Flags<[CoreOption]>;
> +def gno_column_info : Flag<["-"], "gno-column-info">,
> Group, Flags<[CoreOption]>;
>  def gsplit_dwarf : Flag<["-"], "gsplit-dwarf">, Group;
>  def ggnu_pubnames : Flag<["-"], "ggnu-pubnames">, Group;
>  def gdwarf_aranges : Flag<["-"], "gdwarf-aranges">, Group;
>
> Modified: cfe/trunk/lib/Driver/Tools.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=279765=279764=279765=diff
>
> ==
> --- cfe/trunk/lib/Driver/Tools.cpp (original)
> +++ cfe/trunk/lib/Driver/Tools.cpp Thu Aug 25 13:24:35 2016
> @@ -2574,7 +2574,7 @@ static void getTargetFeatures(const Tool
>case llvm::Triple::wasm32:
>case llvm::Triple::wasm64:
>  getWebAssemblyTargetFeatures(Args, Features);
> -break;
> +break;
>case llvm::Triple::sparc:
>case llvm::Triple::sparcel:
>case llvm::Triple::sparcv9:
> @@ -4656,9 +4656,13 @@ void Clang::ConstructJob(Compilation ,
>// We ignore flags -gstrict-dwarf and -grecord-gcc-switches for now.
>Args.ClaimAllArgs(options::OPT_g_flags_Group);
>
> -  // PS4 defaults to no column info
> +  // Column info is included by default for everything except PS4 and
> CodeView.
> +  // Clang doesn't track end columns, just starting columns, which, in
> theory,
> +  // is fine for CodeView (and PDB).  In practice, however, the Microsoft
> +  // debuggers don't handle missing end columns well, so it's better not
> to
> +  // include any column info.
>if (Args.hasFlag(options::OPT_gcolumn_info,
> options::OPT_gno_column_info,
> -   /*Default=*/ !IsPS4CPU))
> +   /*Default=*/ !IsPS4CPU && !(IsWindowsMSVC &&
> EmitCodeView)))
>  CmdArgs.push_back("-dwarf-column-info");
>
>// FIXME: Move backend command line options to the module.
> @@ -6712,7 +6716,7 @@ void ClangAs::ConstructJob(Compilation &
>case llvm::Triple::mips64el:
>  AddMIPSTargetArgs(Args, CmdArgs);
>  break;
> -
> +
>case llvm::Triple::x86:
>case llvm::Triple::x86_64:
>  AddX86TargetArgs(Args, CmdArgs);
>
> Modified: cfe/trunk/test/Driver/cl-options.c
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-options.c?rev=279765=279764=279765=diff
>
> ==
> --- cfe/trunk/test/Driver/cl-options.c (original)
> +++ cfe/trunk/test/Driver/cl-options.c Thu Aug 25 13:24:35 2016
> @@ -50,6 +50,15 @@
>  // fpstrict-NOT: -menable-unsafe-fp-math
>  // fpstrict-NOT: -ffast-math
>
> +// RUN: %clang_cl /Z7 -gcolumn-info -### -- %s 2>&1 | FileCheck
> -check-prefix=gcolumn %s
> +// gcolumn: -dwarf-column-info
> +
> +// RUN: %clang_cl /Z7 -gno-column-info -### -- %s 2>&1 | FileCheck
> -check-prefix=gnocolumn %s
>

We pretty consistently use uppercase names for the filecheck prefixes - and
you can use something shorter if you like, since these are used in such
short scopes (NOCOL, COL, etc)


> +// gnocolumn-NOT: -dwarf-column-info
> +
> +// RUN: %clang_cl /Z7 -### -- %s 2>&1 | FileCheck
> -check-prefix=gdefcolumn %s
> +// 

[PATCH] D23992: [OpenCL] Augment pipe built-ins with pipe packet size and alignment.

2016-08-29 Thread Alexey Bader via cfe-commits
bader created this revision.
bader added reviewers: Anastasia, vpykhtin.
bader added a subscriber: cfe-commits.

Keep pipe packet size and alignment in LLVM IR layer to enable
translation from LLVM IR to SPIR-V format.

https://reviews.llvm.org/D23992

Files:
  lib/CodeGen/CGBuiltin.cpp
  lib/CodeGen/CGOpenCLRuntime.cpp
  lib/CodeGen/CGOpenCLRuntime.h
  test/CodeGenOpenCL/pipe_builtin.cl
  test/CodeGenOpenCL/pipe_types.cl

Index: test/CodeGenOpenCL/pipe_types.cl
===
--- test/CodeGenOpenCL/pipe_types.cl
+++ test/CodeGenOpenCL/pipe_types.cl
@@ -41,7 +41,7 @@
  read_only pipe struct Person SPipe) {
 // CHECK: define void @test_reserved_read_pipe
   read_pipe (SPipe, SDst);
-  // CHECK: call i32 @__read_pipe_2(%opencl.pipe_t* %{{.*}}, i8* %{{.*}})
+  // CHECK: call i32 @__read_pipe_2(%opencl.pipe_t* %{{.*}}, i8* %{{.*}}, i32 16, i32 8)
   read_pipe (SPipe, SDst);
-  // CHECK: call i32 @__read_pipe_2(%opencl.pipe_t* %{{.*}}, i8* %{{.*}})
+  // CHECK: call i32 @__read_pipe_2(%opencl.pipe_t* %{{.*}}, i8* %{{.*}}, i32 16, i32 8)
 }
Index: test/CodeGenOpenCL/pipe_builtin.cl
===
--- test/CodeGenOpenCL/pipe_builtin.cl
+++ test/CodeGenOpenCL/pipe_builtin.cl
@@ -4,58 +4,58 @@
 // CHECK: %opencl.reserve_id_t = type opaque
 
 void test1(read_only pipe int p, global int *ptr) {
-  // CHECK: call i32 @__read_pipe_2(%opencl.pipe_t* %{{.*}}, i8* %{{.*}})
+  // CHECK: call i32 @__read_pipe_2(%opencl.pipe_t* %{{.*}}, i8* %{{.*}}, i32 4, i32 4)
   read_pipe(p, ptr);
-  // CHECK: call %opencl.reserve_id_t* @__reserve_read_pipe(%opencl.pipe_t* %{{.*}}, i32 {{.*}})
+  // CHECK: call %opencl.reserve_id_t* @__reserve_read_pipe(%opencl.pipe_t* %{{.*}}, i32 {{.*}}, i32 4, i32 4)
   reserve_id_t rid = reserve_read_pipe(p, 2);
-  // CHECK: call i32 @__read_pipe_4(%opencl.pipe_t* %{{.*}}, %opencl.reserve_id_t* %{{.*}}, i32 {{.*}}, i8* %{{.*}})
+  // CHECK: call i32 @__read_pipe_4(%opencl.pipe_t* %{{.*}}, %opencl.reserve_id_t* %{{.*}}, i32 {{.*}}, i8* %{{.*}}, i32 4, i32 4)
   read_pipe(p, rid, 2, ptr);
-  // CHECK: call void @__commit_read_pipe(%opencl.pipe_t* %{{.*}}, %opencl.reserve_id_t* %{{.*}})
+  // CHECK: call void @__commit_read_pipe(%opencl.pipe_t* %{{.*}}, %opencl.reserve_id_t* %{{.*}}, i32 4, i32 4)
   commit_read_pipe(p, rid);
 }
 
 void test2(write_only pipe int p, global int *ptr) {
-  // CHECK: call i32 @__write_pipe_2(%opencl.pipe_t* %{{.*}}, i8* %{{.*}})
+  // CHECK: call i32 @__write_pipe_2(%opencl.pipe_t* %{{.*}}, i8* %{{.*}}, i32 4, i32 4)
   write_pipe(p, ptr);
-  // CHECK: call %opencl.reserve_id_t* @__reserve_write_pipe(%opencl.pipe_t* %{{.*}}, i32 {{.*}})
+  // CHECK: call %opencl.reserve_id_t* @__reserve_write_pipe(%opencl.pipe_t* %{{.*}}, i32 {{.*}}, i32 4, i32 4)
   reserve_id_t rid = reserve_write_pipe(p, 2);
-  // CHECK: call i32 @__write_pipe_4(%opencl.pipe_t* %{{.*}}, %opencl.reserve_id_t* %{{.*}}, i32 {{.*}}, i8* %{{.*}})
+  // CHECK: call i32 @__write_pipe_4(%opencl.pipe_t* %{{.*}}, %opencl.reserve_id_t* %{{.*}}, i32 {{.*}}, i8* %{{.*}}, i32 4, i32 4)
   write_pipe(p, rid, 2, ptr);
-  // CHECK: call void @__commit_write_pipe(%opencl.pipe_t* %{{.*}}, %opencl.reserve_id_t* %{{.*}})
+  // CHECK: call void @__commit_write_pipe(%opencl.pipe_t* %{{.*}}, %opencl.reserve_id_t* %{{.*}}, i32 4, i32 4)
   commit_write_pipe(p, rid);
 }
 
 void test3(read_only pipe int p, global int *ptr) {
-  // CHECK: call %opencl.reserve_id_t* @__work_group_reserve_read_pipe(%opencl.pipe_t* %{{.*}}, i32 {{.*}})
+  // CHECK: call %opencl.reserve_id_t* @__work_group_reserve_read_pipe(%opencl.pipe_t* %{{.*}}, i32 {{.*}}, i32 4, i32 4)
   reserve_id_t rid = work_group_reserve_read_pipe(p, 2);
-  // CHECK: call void @__work_group_commit_read_pipe(%opencl.pipe_t* %{{.*}}, %opencl.reserve_id_t* %{{.*}})
+  // CHECK: call void @__work_group_commit_read_pipe(%opencl.pipe_t* %{{.*}}, %opencl.reserve_id_t* %{{.*}}, i32 4, i32 4)
   work_group_commit_read_pipe(p, rid);
 }
 
 void test4(write_only pipe int p, global int *ptr) {
-  // CHECK: call %opencl.reserve_id_t* @__work_group_reserve_write_pipe(%opencl.pipe_t* %{{.*}}, i32 {{.*}})
+  // CHECK: call %opencl.reserve_id_t* @__work_group_reserve_write_pipe(%opencl.pipe_t* %{{.*}}, i32 {{.*}}, i32 4, i32 4)
   reserve_id_t rid = work_group_reserve_write_pipe(p, 2);
-  // CHECK: call void @__work_group_commit_write_pipe(%opencl.pipe_t* %{{.*}}, %opencl.reserve_id_t* %{{.*}})
+  // CHECK: call void @__work_group_commit_write_pipe(%opencl.pipe_t* %{{.*}}, %opencl.reserve_id_t* %{{.*}}, i32 4, i32 4)
   work_group_commit_write_pipe(p, rid);
 }
 
 void test5(read_only pipe int p, global int *ptr) {
-  // CHECK: call %opencl.reserve_id_t* @__sub_group_reserve_read_pipe(%opencl.pipe_t* %{{.*}}, i32 {{.*}})
+  // CHECK: call %opencl.reserve_id_t* @__sub_group_reserve_read_pipe(%opencl.pipe_t* %{{.*}}, i32 {{.*}}, i32 4, i32 4)
   reserve_id_t rid = 

Re: [PATCH] D22766: Handle -mlong-calls on Hexagon

2016-08-29 Thread Krzysztof Parzyszek via cfe-commits
kparzysz added a comment.

Ping.


Repository:
  rL LLVM

https://reviews.llvm.org/D22766



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


Re: [PATCH] D22220: [clang-tidy] Add check 'misc-move-forwarding-reference'

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

One minor typo fix, but otherwise LGTM. Thank you for the check!



Comment at: clang-tidy/misc/MoveForwardingReferenceCheck.cpp:125-126
@@ +124,4 @@
+   "forwarding reference passed to std::move(), which may "
+   "unexpectedly cause lvalues to be moved; use "
+   "std::forward() instead");
+

Anyone understanding what an lvalue is will probably also understand 
indeterminate state. ;-) However, I think the new wording is fine.


Comment at: clang-tidy/misc/MoveForwardingReferenceCheck.h:31
@@ +30,3 @@
+/// indeterminate state) even though no std::move was applied to the lvalue at
+/// the callsite.
+//

s/callsite/call site


https://reviews.llvm.org/D0



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


Re: [PATCH] D22910: Add support for CXXOperatorCallExpr in Expr::HasSideEffects

2016-08-29 Thread Aaron Ballman via cfe-commits
aaron.ballman requested changes to this revision.
This revision now requires changes to proceed.


Comment at: include/clang/AST/ExprCXX.h:109
@@ -108,1 +108,3 @@
 
+  // Check to see if a given overloaded operator is of assignment kind
+  static bool isAssignmentOp(OverloadedOperatorKind Opc) {

Missing the full stop at the end of the sentence.


Comment at: lib/AST/Expr.cpp:2869
@@ +2868,3 @@
+OverloadedOperatorKind Op = cast(this)->getOperator();
+if (CXXOperatorCallExpr::isAssignmentOp(Op)) {
+  const Decl *FD = cast(this)->getCalleeDecl();

Should this also handle overloaded ++ and -- if they're the prefix forms? What 
about overloaded operator new and delete (and the array forms)?


Comment at: lib/AST/Expr.cpp:2876-2877
@@ -2864,4 +2875,4 @@
+  }
   case CallExprClass:
-  case CXXOperatorCallExprClass:
   case CXXMemberCallExprClass:
   case CUDAKernelCallExprClass:

I think this is still missing the comment about fallthrough. Please use 
`LLVM_FALLTHROUGH`.


https://reviews.llvm.org/D22910



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


Re: [PATCH] D23989: Fix -Wunused-but-set-variable warning.

2016-08-29 Thread Haojian Wu via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL279964: Fix -Wunused-but-set-variable warning. (authored by 
hokein).

Changed prior to commit:
  https://reviews.llvm.org/D23989?vs=69554=69559#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D23989

Files:
  llvm/trunk/lib/Target/X86/X86ISelLowering.cpp

Index: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
===
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
@@ -14617,25 +14617,21 @@
 
   MVT LogicVT;
   MVT EltVT;
-  unsigned NumElts;
 
   if (VT.isVector()) {
 LogicVT = VT;
 EltVT = VT.getVectorElementType();
-NumElts = VT.getVectorNumElements();
   } else if (IsF128) {
 // SSE instructions are used for optimized f128 logical operations.
 LogicVT = MVT::f128;
 EltVT = VT;
-NumElts = 1;
   } else {
 // There are no scalar bitwise logical SSE/AVX instructions, so we
 // generate a 16-byte vector constant and logic op even for the scalar 
case.
 // Using a 16-byte mask allows folding the load of the mask with
 // the logic op, so it can save (~4 bytes) on code size.
 LogicVT = (VT == MVT::f64) ? MVT::v2f64 : MVT::v4f32;
 EltVT = VT;
-NumElts = (VT == MVT::f64) ? 2 : 4;
   }
 
   unsigned EltBits = EltVT.getSizeInBits();


Index: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
===
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
@@ -14617,25 +14617,21 @@
 
   MVT LogicVT;
   MVT EltVT;
-  unsigned NumElts;
 
   if (VT.isVector()) {
 LogicVT = VT;
 EltVT = VT.getVectorElementType();
-NumElts = VT.getVectorNumElements();
   } else if (IsF128) {
 // SSE instructions are used for optimized f128 logical operations.
 LogicVT = MVT::f128;
 EltVT = VT;
-NumElts = 1;
   } else {
 // There are no scalar bitwise logical SSE/AVX instructions, so we
 // generate a 16-byte vector constant and logic op even for the scalar case.
 // Using a 16-byte mask allows folding the load of the mask with
 // the logic op, so it can save (~4 bytes) on code size.
 LogicVT = (VT == MVT::f64) ? MVT::v2f64 : MVT::v4f32;
 EltVT = VT;
-NumElts = (VT == MVT::f64) ? 2 : 4;
   }
 
   unsigned EltBits = EltVT.getSizeInBits();
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21134: clang-tidy: new check readability-misplaced-array-index

2016-08-29 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki marked 4 inline comments as done.
danielmarjamaki added a comment.

https://reviews.llvm.org/D21134



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


Re: [PATCH] D21134: clang-tidy: new check readability-misplaced-array-index

2016-08-29 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 69558.
danielmarjamaki marked 2 inline comments as done.
danielmarjamaki added a comment.

fix review comments


https://reviews.llvm.org/D21134

Files:
  clang-tidy/readability/CMakeLists.txt
  clang-tidy/readability/MisplacedArrayIndexCheck.cpp
  clang-tidy/readability/MisplacedArrayIndexCheck.h
  clang-tidy/readability/ReadabilityTidyModule.cpp
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/readability-misplaced-array-index.rst
  test/clang-tidy/readability-misplaced-array-index.cpp

Index: test/clang-tidy/readability-misplaced-array-index.cpp
===
--- test/clang-tidy/readability-misplaced-array-index.cpp
+++ test/clang-tidy/readability-misplaced-array-index.cpp
@@ -0,0 +1,34 @@
+// RUN: %check_clang_tidy %s readability-misplaced-array-index %t
+
+#define ABC  "abc"
+
+struct XY { int *X; int *Y; };
+
+void dostuff(int);
+
+void unusualSyntax(int *P1, struct XY *P2) {
+  10[P1] = 0;
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: confusing array subscript expression, usually the index is inside the []
+  // CHECK-FIXES: P1[10] = 0;
+
+  10[P2->X] = 0;
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: confusing array subscript expression
+  // CHECK-FIXES: P2->X[10] = 0;
+
+  dostuff(1["abc"]);
+  // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: confusing array subscript expression
+  // CHECK-FIXES:  dostuff("abc"[1]);
+
+  dostuff(1[ABC]);
+  // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: confusing array subscript expression
+  // CHECK-FIXES:  dostuff(ABC[1]);
+
+  dostuff(0[0 + ABC]);
+  // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: confusing array subscript expression
+  // CHECK-FIXES:  dostuff(0[0 + ABC]);
+  // No fixit. Probably the code should be ABC[0]
+}
+
+void normalSyntax(int *X) {
+  X[10] = 0;
+}
Index: docs/clang-tidy/checks/readability-misplaced-array-index.rst
===
--- docs/clang-tidy/checks/readability-misplaced-array-index.rst
+++ docs/clang-tidy/checks/readability-misplaced-array-index.rst
@@ -0,0 +1,27 @@
+.. title:: clang-tidy - readability-misplaced-array-index
+
+readability-misplaced-array-index
+=
+
+This check warns for unusual array index syntax.
+
+The following code has unusual array index syntax:
+
+.. code-block:: c++
+
+  void f(int *X, int Y) {
+Y[X] = 0;
+  }
+
+becomes
+
+.. code-block:: c++
+
+  void f(int *X, int Y) {
+X[Y] = 0;
+  }
+
+The check warns about such unusual syntax for readability reasons:
+ * There are programmers that are not familiar with this unusual syntax.
+ * It is possible that variables are mixed up.
+
Index: docs/clang-tidy/checks/list.rst
===
--- docs/clang-tidy/checks/list.rst
+++ docs/clang-tidy/checks/list.rst
@@ -127,6 +127,7 @@
readability-identifier-naming
readability-implicit-bool-cast
readability-inconsistent-declaration-parameter-name
+   readability-misplaced-array-index
readability-named-parameter
readability-non-const-parameter
readability-redundant-control-flow
Index: docs/ReleaseNotes.rst
===
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -85,6 +85,11 @@
   Warns about the performance overhead arising from concatenating strings using
   the ``operator+``, instead of ``operator+=``.
 
+- New `readability-misplaced-array-index
+  `_ check
+
+  Warns when there is array index before the [] instead of inside it.
+
 - New `readability-non-const-parameter
   `_ check
 
Index: clang-tidy/readability/ReadabilityTidyModule.cpp
===
--- clang-tidy/readability/ReadabilityTidyModule.cpp
+++ clang-tidy/readability/ReadabilityTidyModule.cpp
@@ -19,6 +19,7 @@
 #include "IdentifierNamingCheck.h"
 #include "ImplicitBoolCastCheck.h"
 #include "InconsistentDeclarationParameterNameCheck.h"
+#include "MisplacedArrayIndexCheck.h"
 #include "NamedParameterCheck.h"
 #include "NonConstParameterCheck.h"
 #include "RedundantControlFlowCheck.h"
@@ -54,6 +55,8 @@
 "readability-implicit-bool-cast");
 CheckFactories.registerCheck(
 "readability-inconsistent-declaration-parameter-name");
+CheckFactories.registerCheck(
+"readability-misplaced-array-index");
 CheckFactories.registerCheck(
 "readability-static-definition-in-anonymous-namespace");
 CheckFactories.registerCheck(
Index: clang-tidy/readability/MisplacedArrayIndexCheck.h
===
--- clang-tidy/readability/MisplacedArrayIndexCheck.h
+++ 

Re: [PATCH] D17983: Eliminate many benign instances of "potentially uninitialized local variable" warnings

2016-08-29 Thread Sergio Martins via cfe-commits
iamsergio added a comment.

In https://reviews.llvm.org/D17983#527399, @iamsergio wrote:

> @ariccio, are you blocked on this or waiting for reviewers ? This seems to be 
> blocking the patch that fixes plugins on MSVC, thanks


https://llvm.org/bugs/show_bug.cgi?id=11446 comment #6 links to this review, 
but I think it might have been a mistake and unrelated.


https://reviews.llvm.org/D17983



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


Re: [PATCH] D12407: [clang-format-vs] Add an option to reformat source code when file is saved to disk

2016-08-29 Thread Jason Juang via cfe-commits
jasjuang added a comment.

@jsmouret Bravo for the improved solution!


https://reviews.llvm.org/D12407



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


Re: [PATCH] D23160: [Coverage] Prevent creating a redundant counter if a nested body ends with a macro.

2016-08-29 Thread Igor Kudrin via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL279962: [Coverage] Prevent creating a redundant counter if a 
nested body ends with a… (authored by ikudrin).

Changed prior to commit:
  https://reviews.llvm.org/D23160?vs=66790=69556#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D23160

Files:
  cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
  cfe/trunk/test/CoverageMapping/macros.c

Index: cfe/trunk/test/CoverageMapping/macros.c
===
--- cfe/trunk/test/CoverageMapping/macros.c
+++ cfe/trunk/test/CoverageMapping/macros.c
@@ -36,8 +36,20 @@
 // CHECK-NEXT: File 1, 4:17 -> 4:22 = #0
 // CHECK-NEXT: File 2, 4:17 -> 4:22 = #0
 
+// CHECK-NEXT: func4
+void func4() { // CHECK-NEXT: File 0, [[@LINE]]:14 -> [[@LINE+6]]:2 = #0
+  int i = 0;
+  while (i++ < 10) // CHECK-NEXT: File 0, [[@LINE]]:10 -> [[@LINE]]:18 = (#0 + 
#1)
+if (i < 5) // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE+2]]:14 = #1
+   // CHECK-NEXT: File 0, [[@LINE-1]]:9 -> [[@LINE-1]]:14 = #1
+  MACRO_2; // CHECK-NEXT: Expansion,File 0, [[@LINE]]:7 -> [[@LINE]]:14 = 
#2
+}
+// CHECK-NEXT: File 1, 4:17 -> 4:22 = #2
+// CHECK-NOT: File 1
+
 int main(int argc, const char *argv[]) {
   func();
   func2();
   func3();
+  func4();
 }
Index: cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
===
--- cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
+++ cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
@@ -432,7 +432,8 @@
   SourceLocation NestedLoc = getStartOfFileOrMacro(EndLoc);
   assert(SM.isWrittenInSameFile(NestedLoc, EndLoc));
 
-  SourceRegions.emplace_back(Region.getCounter(), NestedLoc, EndLoc);
+  if (!isRegionAlreadyAdded(NestedLoc, EndLoc))
+SourceRegions.emplace_back(Region.getCounter(), NestedLoc, EndLoc);
 
   EndLoc = getPreciseTokenLocEnd(getIncludeOrExpansionLoc(EndLoc));
   if (EndLoc.isInvalid())


Index: cfe/trunk/test/CoverageMapping/macros.c
===
--- cfe/trunk/test/CoverageMapping/macros.c
+++ cfe/trunk/test/CoverageMapping/macros.c
@@ -36,8 +36,20 @@
 // CHECK-NEXT: File 1, 4:17 -> 4:22 = #0
 // CHECK-NEXT: File 2, 4:17 -> 4:22 = #0
 
+// CHECK-NEXT: func4
+void func4() { // CHECK-NEXT: File 0, [[@LINE]]:14 -> [[@LINE+6]]:2 = #0
+  int i = 0;
+  while (i++ < 10) // CHECK-NEXT: File 0, [[@LINE]]:10 -> [[@LINE]]:18 = (#0 + #1)
+if (i < 5) // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE+2]]:14 = #1
+   // CHECK-NEXT: File 0, [[@LINE-1]]:9 -> [[@LINE-1]]:14 = #1
+  MACRO_2; // CHECK-NEXT: Expansion,File 0, [[@LINE]]:7 -> [[@LINE]]:14 = #2
+}
+// CHECK-NEXT: File 1, 4:17 -> 4:22 = #2
+// CHECK-NOT: File 1
+
 int main(int argc, const char *argv[]) {
   func();
   func2();
   func3();
+  func4();
 }
Index: cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
===
--- cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
+++ cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
@@ -432,7 +432,8 @@
   SourceLocation NestedLoc = getStartOfFileOrMacro(EndLoc);
   assert(SM.isWrittenInSameFile(NestedLoc, EndLoc));
 
-  SourceRegions.emplace_back(Region.getCounter(), NestedLoc, EndLoc);
+  if (!isRegionAlreadyAdded(NestedLoc, EndLoc))
+SourceRegions.emplace_back(Region.getCounter(), NestedLoc, EndLoc);
 
   EndLoc = getPreciseTokenLocEnd(getIncludeOrExpansionLoc(EndLoc));
   if (EndLoc.isInvalid())
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23987: [Coverage] Suppress creating a code region if the same area is covered by an expansion region.

2016-08-29 Thread Igor Kudrin via cfe-commits
ikudrin added a comment.

This patch fixes the following issue:

  $ cat > test.cpp << EOF
  void dummy() {}
  
  #define MACRO_1 dummy()
  
  #define MACRO_2 MACRO_1
  
  int main() {
int i = 0;
if (i > 5)
  MACRO_2;
  }
  EOF
  $ clang++ -fprofile-instr-generate -fcoverage-mapping dummy.cpp test.cpp
  $ ./a.out
  $ llvm-profdata merge -o default.profdata default.profraw
  $ llvm-cov show a.out -instr-profile --show-expansions default.profdata
  1|  0|void dummy() {}
  2|   |
  3|  0|#define MACRO_1 dummy()
  4|   |
  5|  1|#define MACRO_2 MACRO_1
  6|   |
  7|  1|int main() {
  8|  1|  int i = 0;
  9|  1|  if (i > 5)
 10|  1|MACRO_2;
--
|  |5|  1|#define MACRO_2 MACRO_1
|  |  --
|  |  |  |3|  0|#define MACRO_1 dummy()
|  |  --
--
 11|  1|}

The result of the fixed version:

1|  0|void dummy() {}
2|   |
3|  0|#define MACRO_1 dummy()
4|   |
5|  0|#define MACRO_2 MACRO_1
6|   |
7|  1|int main() {
8|  1|  int i = 0;
9|  1|  if (i > 5)
   10|  0|MACRO_2;
  --
  |  |5|  0|#define MACRO_2 MACRO_1
  |  |  --
  |  |  |  |3|  0|#define MACRO_1 dummy()
  |  |  --
  --
   11|  1|}


https://reviews.llvm.org/D23987



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


Re: [PATCH] D23989: Fix -Wunused-but-set-variable warning.

2016-08-29 Thread Benjamin Kramer via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

lg. Feel free to submit trivial changes like this without pre-commit review.


https://reviews.llvm.org/D23989



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


[PATCH] D23989: Fix -Wunused-but-set-variable warning.

2016-08-29 Thread Haojian Wu via cfe-commits
hokein created this revision.
hokein added a reviewer: bkramer.
hokein added a subscriber: cfe-commits.

A follow-up fix on r279958.

https://reviews.llvm.org/D23989

Files:
  lib/Target/X86/X86ISelLowering.cpp

Index: lib/Target/X86/X86ISelLowering.cpp
===
--- lib/Target/X86/X86ISelLowering.cpp
+++ lib/Target/X86/X86ISelLowering.cpp
@@ -14617,25 +14617,21 @@
 
   MVT LogicVT;
   MVT EltVT;
-  unsigned NumElts;
 
   if (VT.isVector()) {
 LogicVT = VT;
 EltVT = VT.getVectorElementType();
-NumElts = VT.getVectorNumElements();
   } else if (IsF128) {
 // SSE instructions are used for optimized f128 logical operations.
 LogicVT = MVT::f128;
 EltVT = VT;
-NumElts = 1;
   } else {
 // There are no scalar bitwise logical SSE/AVX instructions, so we
 // generate a 16-byte vector constant and logic op even for the scalar 
case.
 // Using a 16-byte mask allows folding the load of the mask with
 // the logic op, so it can save (~4 bytes) on code size.
 LogicVT = (VT == MVT::f64) ? MVT::v2f64 : MVT::v4f32;
 EltVT = VT;
-NumElts = (VT == MVT::f64) ? 2 : 4;
   }
 
   unsigned EltBits = EltVT.getSizeInBits();


Index: lib/Target/X86/X86ISelLowering.cpp
===
--- lib/Target/X86/X86ISelLowering.cpp
+++ lib/Target/X86/X86ISelLowering.cpp
@@ -14617,25 +14617,21 @@
 
   MVT LogicVT;
   MVT EltVT;
-  unsigned NumElts;
 
   if (VT.isVector()) {
 LogicVT = VT;
 EltVT = VT.getVectorElementType();
-NumElts = VT.getVectorNumElements();
   } else if (IsF128) {
 // SSE instructions are used for optimized f128 logical operations.
 LogicVT = MVT::f128;
 EltVT = VT;
-NumElts = 1;
   } else {
 // There are no scalar bitwise logical SSE/AVX instructions, so we
 // generate a 16-byte vector constant and logic op even for the scalar case.
 // Using a 16-byte mask allows folding the load of the mask with
 // the logic op, so it can save (~4 bytes) on code size.
 LogicVT = (VT == MVT::f64) ? MVT::v2f64 : MVT::v4f32;
 EltVT = VT;
-NumElts = (VT == MVT::f64) ? 2 : 4;
   }
 
   unsigned EltBits = EltVT.getSizeInBits();
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23160: [Coverage] Prevent creating a redundant counter if a nested body ends with a macro.

2016-08-29 Thread Igor Kudrin via cfe-commits
ikudrin added a comment.

I figured out that the last issue is an independent one, so I prepared a 
separate fix for it: https://reviews.llvm.org/D23987.


https://reviews.llvm.org/D23160



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


Re: [PATCH] D23985: [InstructionSelect] NumBlocks isn't defined in DEBUG build.

2016-08-29 Thread Haojian Wu via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL279959: [InstructionSelect] NumBlocks isn't defined in DEBUG 
build. (authored by hokein).

Changed prior to commit:
  https://reviews.llvm.org/D23985?vs=69540=69542#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D23985

Files:
  llvm/trunk/lib/CodeGen/GlobalISel/InstructionSelect.cpp

Index: llvm/trunk/lib/CodeGen/GlobalISel/InstructionSelect.cpp
===
--- llvm/trunk/lib/CodeGen/GlobalISel/InstructionSelect.cpp
+++ llvm/trunk/lib/CodeGen/GlobalISel/InstructionSelect.cpp
@@ -81,10 +81,10 @@
 if (isPreISelGenericOpcode(MI.getOpcode()) && !MLI->isLegal(MI))
   reportSelectionError(MI, "Instruction is not legal");
 
+#endif
   // FIXME: We could introduce new blocks and will need to fix the outer loop.
   // Until then, keep track of the number of blocks to assert that we don't.
   const size_t NumBlocks = MF.size();
-#endif
 
   bool Failed = false;
   for (MachineBasicBlock *MBB : post_order()) {


Index: llvm/trunk/lib/CodeGen/GlobalISel/InstructionSelect.cpp
===
--- llvm/trunk/lib/CodeGen/GlobalISel/InstructionSelect.cpp
+++ llvm/trunk/lib/CodeGen/GlobalISel/InstructionSelect.cpp
@@ -81,10 +81,10 @@
 if (isPreISelGenericOpcode(MI.getOpcode()) && !MLI->isLegal(MI))
   reportSelectionError(MI, "Instruction is not legal");
 
+#endif
   // FIXME: We could introduce new blocks and will need to fix the outer loop.
   // Until then, keep track of the number of blocks to assert that we don't.
   const size_t NumBlocks = MF.size();
-#endif
 
   bool Failed = false;
   for (MachineBasicBlock *MBB : post_order()) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23985: [InstructionSelect] NumBlocks isn't defined in DEBUG build.

2016-08-29 Thread Benjamin Kramer via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

lg


https://reviews.llvm.org/D23985



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


[PATCH] D23985: [InstructionSelect] NumBlocks isn't defined in DEBUG build.

2016-08-29 Thread Haojian Wu via cfe-commits
hokein created this revision.
hokein added a reviewer: bkramer.
hokein added a subscriber: cfe-commits.

A follow-up fixing on 
http://llvm.org/viewvc/llvm-project?view=revision=279905.

https://reviews.llvm.org/D23985

Files:
  lib/CodeGen/GlobalISel/InstructionSelect.cpp

Index: lib/CodeGen/GlobalISel/InstructionSelect.cpp
===
--- lib/CodeGen/GlobalISel/InstructionSelect.cpp
+++ lib/CodeGen/GlobalISel/InstructionSelect.cpp
@@ -81,10 +81,10 @@
 if (isPreISelGenericOpcode(MI.getOpcode()) && !MLI->isLegal(MI))
   reportSelectionError(MI, "Instruction is not legal");
 
+#endif
   // FIXME: We could introduce new blocks and will need to fix the outer loop.
   // Until then, keep track of the number of blocks to assert that we don't.
   const size_t NumBlocks = MF.size();
-#endif
 
   bool Failed = false;
   for (MachineBasicBlock *MBB : post_order()) {


Index: lib/CodeGen/GlobalISel/InstructionSelect.cpp
===
--- lib/CodeGen/GlobalISel/InstructionSelect.cpp
+++ lib/CodeGen/GlobalISel/InstructionSelect.cpp
@@ -81,10 +81,10 @@
 if (isPreISelGenericOpcode(MI.getOpcode()) && !MLI->isLegal(MI))
   reportSelectionError(MI, "Instruction is not legal");
 
+#endif
   // FIXME: We could introduce new blocks and will need to fix the outer loop.
   // Until then, keep track of the number of blocks to assert that we don't.
   const size_t NumBlocks = MF.size();
-#endif
 
   bool Failed = false;
   for (MachineBasicBlock *MBB : post_order()) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D23918: [clang-tidy docs] Add missing option docs.

2016-08-29 Thread Haojian Wu via cfe-commits
hokein updated this revision to Diff 69539.
hokein added a comment.

Remove extra blank line.


https://reviews.llvm.org/D23918

Files:
  docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-constant-array-index.rst
  docs/clang-tidy/checks/google-build-namespaces.rst
  docs/clang-tidy/checks/google-runtime-int.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/llvm-namespace-comment.rst
  docs/clang-tidy/checks/misc-definitions-in-headers.rst
  docs/clang-tidy/checks/misc-move-constructor-init.rst
  docs/clang-tidy/checks/misc-sizeof-expression.rst
  docs/clang-tidy/checks/misc-string-constructor.rst
  docs/clang-tidy/checks/misc-suspicious-missing-comma.rst
  docs/clang-tidy/checks/misc-suspicious-string-compare.rst
  docs/clang-tidy/checks/modernize-pass-by-value.rst
  docs/clang-tidy/checks/modernize-replace-auto-ptr.rst
  docs/clang-tidy/checks/performance-for-range-copy.rst
  docs/clang-tidy/checks/performance-inefficient-string-concatenation.rst
  docs/clang-tidy/checks/performance-unnecessary-value-param.rst
  docs/clang-tidy/checks/readability-implicit-bool-cast.rst

Index: docs/clang-tidy/checks/readability-implicit-bool-cast.rst
===
--- docs/clang-tidy/checks/readability-implicit-bool-cast.rst
+++ docs/clang-tidy/checks/readability-implicit-bool-cast.rst
@@ -97,3 +97,15 @@
 
 Occurrences of implicit casts inside macros and template instantiations are
 deliberately ignored, as it is not clear how to deal with such cases.
+
+Options
+---
+
+.. option::  AllowConditionalIntegerCasts
+
+   When non-zero, the check will allow conditional integer casts. Default is
+   `0`.
+
+.. option::  AllowConditionalPointerCasts
+
+   When non-zero, the check will allow conditional pointer casts. Default is `0`.
Index: docs/clang-tidy/checks/performance-unnecessary-value-param.rst
===
--- docs/clang-tidy/checks/performance-unnecessary-value-param.rst
+++ docs/clang-tidy/checks/performance-unnecessary-value-param.rst
@@ -53,3 +53,11 @@
   void setValue(string Value) {
 Field = std::move(Value);
   }
+
+Options
+---
+
+.. option:: IncludeStyle
+
+   A string represents which include-style is used, `llvm` or `google`. Default
+   is `llvm`.
Index: docs/clang-tidy/checks/performance-inefficient-string-concatenation.rst
===
--- docs/clang-tidy/checks/performance-inefficient-string-concatenation.rst
+++ docs/clang-tidy/checks/performance-inefficient-string-concatenation.rst
@@ -4,14 +4,14 @@
 
 
 This check warns about the performance overhead arising from concatenating strings using the ``operator+``, for instance:
-
+
 .. code:: c++
 
 std::string a("Foo"), b("Bar");
 a = a + b;
 
 Instead of this structure you should use ``operator+=`` or ``std::string``'s (``std::basic_string``) class member function ``append()``. For instance:
-   
+
 .. code:: c++
 
std::string a("Foo"), b("Baz");
@@ -26,7 +26,7 @@
std::string a("Foo"), b("Baz");
for (int i = 0; i < 2; ++i) {
a.append("Bar").append(b);
-   } 
+   }
 
 And this can be rewritten too:
 
@@ -47,3 +47,11 @@
void g() {
f(std::string(a).append("Bar").append(b));
}
+
+Options
+---
+
+.. option:: StrictMode
+
+   When zero, the check will only check the string usage in ``while``, ``for``
+   and ``for-range`` statements. Default is `0`.
Index: docs/clang-tidy/checks/performance-for-range-copy.rst
===
--- docs/clang-tidy/checks/performance-for-range-copy.rst
+++ docs/clang-tidy/checks/performance-for-range-copy.rst
@@ -17,3 +17,10 @@
 2. The loop variable is not const, but only const methods or operators are
invoked on it, or it is used as const reference or value argument in
constructors or function calls.
+
+Options
+---
+
+.. option:: WarnOnAllAutoCopies
+
+   When non-zero, the check will warn on all auto copies. Default is `0`.
Index: docs/clang-tidy/checks/modernize-replace-auto-ptr.rst
===
--- docs/clang-tidy/checks/modernize-replace-auto-ptr.rst
+++ docs/clang-tidy/checks/modernize-replace-auto-ptr.rst
@@ -70,3 +70,10 @@
 
  // only 'f()' (or similar) will trigger the replacement.
 
+Options
+---
+
+.. option:: IncludeStyle
+
+   A string represents which include-style is used, `llvm` or `google`. Default
+   is `llvm`.
Index: docs/clang-tidy/checks/modernize-pass-by-value.rst
===
--- docs/clang-tidy/checks/modernize-pass-by-value.rst
+++ docs/clang-tidy/checks/modernize-pass-by-value.rst
@@ -151,3 +151,11 @@
   For more information about the pass-by-value idiom, read: `Want Speed? Pass by Value`_.
 
   .. _Want Speed? Pass by Value: