[PATCH] D26105: Allow CaseStmt to be initialized with a SubStmt

2016-10-31 Thread Alexey Bataev via cfe-commits
ABataev added a comment.

Add a test




Comment at: include/clang/AST/Stmt.h:697
+   SourceLocation ellipsisLoc, SourceLocation colonLoc,
+   Stmt *SubStmt=nullptr)
 : SwitchCase(CaseStmtClass, caseLoc, colonLoc) {

I don't think you need this new param. You can create an instance if CaseStmt, 
then call `setSubStmt()` and after that return this instance.


https://reviews.llvm.org/D26105



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


r285548 - [Modules] Add a command line option for loading the clang builtins modulemap.

2016-10-31 Thread Elad Cohen via cfe-commits
Author: eladcohen
Date: Mon Oct 31 03:21:54 2016
New Revision: 285548

URL: http://llvm.org/viewvc/llvm-project?rev=285548&view=rev
Log:
[Modules] Add a command line option for loading the clang builtins modulemap.

-fbuiltin-module-map loads the clang builtins modulemap file. (This is
equivalent to -fmodule-map-file=/include/module.modulemap)

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


Modified:
cfe/trunk/docs/Modules.rst
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/modules.m
cfe/trunk/test/Modules/compiler_builtins.m
cfe/trunk/test/Modules/compiler_builtins_x86.c
cfe/trunk/test/lit.cfg

Modified: cfe/trunk/docs/Modules.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/Modules.rst?rev=285548&r1=285547&r2=285548&view=diff
==
--- cfe/trunk/docs/Modules.rst (original)
+++ cfe/trunk/docs/Modules.rst Mon Oct 31 03:21:54 2016
@@ -174,6 +174,9 @@ Command-line parameters
 ``-fmodules``
   Enable the modules feature.
 
+``-fbuiltin-module-map``
+  Load the Clang builtins module map file. (Equivalent to 
``-fmodule-map-file=/include/module.modulemap``)
+
 ``-fimplicit-module-maps``
   Enable implicit search for module map files named ``module.modulemap`` and 
similar. This option is implied by ``-fmodules``. If this is disabled with 
``-fno-implicit-module-maps``, module map files will only be loaded if they are 
explicitly specified via ``-fmodule-map-file`` or transitively used by another 
module map file.
 

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=285548&r1=285547&r2=285548&view=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Mon Oct 31 03:21:54 2016
@@ -553,6 +553,8 @@ def fbootclasspath_EQ : Joined<["-"], "f
 def fborland_extensions : Flag<["-"], "fborland-extensions">, Group, 
Flags<[CC1Option]>,
   HelpText<"Accept non-standard constructs supported by the Borland compiler">;
 def fbuiltin : Flag<["-"], "fbuiltin">, Group;
+def fbuiltin_module_map : Flag <["-"], "fbuiltin-module-map">, Group,
+  Flags<[DriverOption]>, HelpText<"Load the clang builtins module map file.">;
 def fcaret_diagnostics : Flag<["-"], "fcaret-diagnostics">, Group;
 def fclasspath_EQ : Joined<["-"], "fclasspath=">, Group;
 def fcolor_diagnostics : Flag<["-"], "fcolor-diagnostics">, Group,

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=285548&r1=285547&r2=285548&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Mon Oct 31 03:21:54 2016
@@ -5636,6 +5636,18 @@ void Clang::ConstructJob(Compilation &C,
   // definitions.
   Args.AddAllArgs(CmdArgs, options::OPT_fmodule_map_file);
 
+  // -fbuiltin-module-map can be used to load the clang
+  // builtin headers modulemap file.
+  if (Args.hasArg(options::OPT_fbuiltin_module_map)) {
+SmallString<128> BuiltinModuleMap(getToolChain().getDriver().ResourceDir);
+llvm::sys::path::append(BuiltinModuleMap, "include");
+llvm::sys::path::append(BuiltinModuleMap, "module.modulemap");
+if (llvm::sys::fs::exists(BuiltinModuleMap)) {
+  CmdArgs.push_back(Args.MakeArgString("-fmodule-map-file=" +
+   BuiltinModuleMap));
+}
+  }
+
   // -fmodule-file can be used to specify files containing precompiled modules.
   if (HaveAnyModules)
 Args.AddAllArgs(CmdArgs, options::OPT_fmodule_file);

Modified: cfe/trunk/test/Driver/modules.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/modules.m?rev=285548&r1=285547&r2=285548&view=diff
==
--- cfe/trunk/test/Driver/modules.m (original)
+++ cfe/trunk/test/Driver/modules.m Mon Oct 31 03:21:54 2016
@@ -51,6 +51,10 @@
 // CHECK-MODULE-MAP-FILES: "-fmodule-map-file=foo.map"
 // CHECK-MODULE-MAP-FILES: "-fmodule-map-file=bar.map"
 
+// RUN: %clang -fmodules -fbuiltin-module-map -### %s 2>&1 | FileCheck 
-check-prefix=CHECK-BUILTIN-MODULE-MAP %s
+// CHECK-BUILTIN-MODULE-MAP: "-fmodules"
+// CHECK-BUILTIN-MODULE-MAP: 
"-fmodule-map-file={{.*}}include{{/|}}module.modulemap"
+
 // RUN: %clang -fmodules -fmodule-file=foo.pcm -fmodule-file=bar.pcm -### %s 
2>&1 | FileCheck -check-prefix=CHECK-MODULE-FILES %s
 // CHECK-MODULE-FILES: "-fmodules"
 // CHECK-MODULE-FILES: "-fmodule-file=foo.pcm"

Modified: cfe/trunk/test/Modules/compiler_builtins.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/compiler_builtins.m?rev=285548&r1=285547&r2=285548&view=diff
=

[PATCH] D25767: [Modules] Add a command line option for loading the clang builtins modulemap file.

2016-10-31 Thread Elad Cohen via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL285548: [Modules] Add a command line option for loading the 
clang builtins modulemap. (authored by eladcohen).

Changed prior to commit:
  https://reviews.llvm.org/D25767?vs=75133&id=76355#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25767

Files:
  cfe/trunk/docs/Modules.rst
  cfe/trunk/include/clang/Driver/Options.td
  cfe/trunk/lib/Driver/Tools.cpp
  cfe/trunk/test/Driver/modules.m
  cfe/trunk/test/Modules/compiler_builtins.m
  cfe/trunk/test/Modules/compiler_builtins_x86.c
  cfe/trunk/test/lit.cfg


Index: cfe/trunk/docs/Modules.rst
===
--- cfe/trunk/docs/Modules.rst
+++ cfe/trunk/docs/Modules.rst
@@ -174,6 +174,9 @@
 ``-fmodules``
   Enable the modules feature.
 
+``-fbuiltin-module-map``
+  Load the Clang builtins module map file. (Equivalent to 
``-fmodule-map-file=/include/module.modulemap``)
+
 ``-fimplicit-module-maps``
   Enable implicit search for module map files named ``module.modulemap`` and 
similar. This option is implied by ``-fmodules``. If this is disabled with 
``-fno-implicit-module-maps``, module map files will only be loaded if they are 
explicitly specified via ``-fmodule-map-file`` or transitively used by another 
module map file.
 
Index: cfe/trunk/include/clang/Driver/Options.td
===
--- cfe/trunk/include/clang/Driver/Options.td
+++ cfe/trunk/include/clang/Driver/Options.td
@@ -553,6 +553,8 @@
 def fborland_extensions : Flag<["-"], "fborland-extensions">, Group, 
Flags<[CC1Option]>,
   HelpText<"Accept non-standard constructs supported by the Borland compiler">;
 def fbuiltin : Flag<["-"], "fbuiltin">, Group;
+def fbuiltin_module_map : Flag <["-"], "fbuiltin-module-map">, Group,
+  Flags<[DriverOption]>, HelpText<"Load the clang builtins module map file.">;
 def fcaret_diagnostics : Flag<["-"], "fcaret-diagnostics">, Group;
 def fclasspath_EQ : Joined<["-"], "fclasspath=">, Group;
 def fcolor_diagnostics : Flag<["-"], "fcolor-diagnostics">, Group,
Index: cfe/trunk/test/Driver/modules.m
===
--- cfe/trunk/test/Driver/modules.m
+++ cfe/trunk/test/Driver/modules.m
@@ -51,6 +51,10 @@
 // CHECK-MODULE-MAP-FILES: "-fmodule-map-file=foo.map"
 // CHECK-MODULE-MAP-FILES: "-fmodule-map-file=bar.map"
 
+// RUN: %clang -fmodules -fbuiltin-module-map -### %s 2>&1 | FileCheck 
-check-prefix=CHECK-BUILTIN-MODULE-MAP %s
+// CHECK-BUILTIN-MODULE-MAP: "-fmodules"
+// CHECK-BUILTIN-MODULE-MAP: 
"-fmodule-map-file={{.*}}include{{/|}}module.modulemap"
+
 // RUN: %clang -fmodules -fmodule-file=foo.pcm -fmodule-file=bar.pcm -### %s 
2>&1 | FileCheck -check-prefix=CHECK-MODULE-FILES %s
 // CHECK-MODULE-FILES: "-fmodules"
 // CHECK-MODULE-FILES: "-fmodule-file=foo.pcm"
Index: cfe/trunk/test/lit.cfg
===
--- cfe/trunk/test/lit.cfg
+++ cfe/trunk/test/lit.cfg
@@ -268,6 +268,7 @@
 config.substitutions.append( ('%test_debuginfo', ' ' + config.llvm_src_root + 
'/utils/test_debuginfo.pl ') )
 config.substitutions.append( ('%itanium_abi_triple', 
makeItaniumABITriple(config.target_triple)) )
 config.substitutions.append( ('%ms_abi_triple', 
makeMSABITriple(config.target_triple)) )
+config.substitutions.append( ('%resource_dir', 
getClangBuiltinIncludeDir(config.clang)) )
 
 # The host triple might not be set, at least if we're compiling clang from
 # an already installed llvm.
Index: cfe/trunk/test/Modules/compiler_builtins_x86.c
===
--- cfe/trunk/test/Modules/compiler_builtins_x86.c
+++ cfe/trunk/test/Modules/compiler_builtins_x86.c
@@ -1,5 +1,6 @@
 // RUN: rm -rf %t
 // RUN: %clang_cc1 -triple i686-unknown-unknown -fsyntax-only -fmodules 
-fimplicit-module-maps -fmodules-cache-path=%t %s -verify -ffreestanding
+// RUN: %clang_cc1 -triple i686-unknown-unknown -fsyntax-only -fmodules 
-fmodule-map-file=%resource_dir/module.modulemap -fmodules-cache-path=%t %s 
-verify -ffreestanding
 // expected-no-diagnostics
 
 #include
Index: cfe/trunk/test/Modules/compiler_builtins.m
===
--- cfe/trunk/test/Modules/compiler_builtins.m
+++ cfe/trunk/test/Modules/compiler_builtins.m
@@ -1,6 +1,7 @@
 // RUN: rm -rf %t
 // RUN: %clang_cc1 -fsyntax-only -fmodules -fimplicit-module-maps 
-fmodules-cache-path=%t %s -I%S/Inputs/System/usr/include -verify
 // RUN: %clang_cc1 -fsyntax-only -std=c99 -fmodules -fimplicit-module-maps 
-fmodules-cache-path=%t %s -I%S/Inputs/System/usr/include -verify
+// RUN: %clang_cc1 -fsyntax-only -fmodules 
-fmodule-map-file=%resource_dir/module.modulemap -fmodules-cache-path=%t %s 
-I%S/Inputs/System/usr/include -verify
 // expected-no-diagnostics
 
 #ifdef __SSE__
Index: cfe/trunk/lib/Driver/Tools.cpp
===

[PATCH] D25767: [Modules] Add a command line option for loading the clang builtins modulemap file.

2016-10-31 Thread Elad Cohen via cfe-commits
eladcohen added a comment.

Thanks for the review! committed r285548.


Repository:
  rL LLVM

https://reviews.llvm.org/D25767



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


[clang-tools-extra] r285549 - [change-namespace] fix namespace specifiers of template arguments.

2016-10-31 Thread Eric Liu via cfe-commits
Author: ioeric
Date: Mon Oct 31 03:28:29 2016
New Revision: 285549

URL: http://llvm.org/viewvc/llvm-project?rev=285549&view=rev
Log:
[change-namespace] fix namespace specifiers of template arguments.

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

Modified: clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp?rev=285549&r1=285548&r2=285549&view=diff
==
--- clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp (original)
+++ clang-tools-extra/trunk/change-namespace/ChangeNamespace.cpp Mon Oct 31 
03:28:29 2016
@@ -272,13 +272,15 @@ void ChangeNamespaceTool::registerMatche
   allOf(IsInMovedNs, unless(cxxRecordDecl(unless(isDefinition(;
 
   // Match TypeLocs on the declaration. Carefully match only the outermost
-  // TypeLoc that's directly linked to the old class and don't handle nested
-  // name specifier locs.
+  // TypeLoc and template specialization arguments (which are not outermost)
+  // that are directly linked to types matching `DeclMatcher`. Nested name
+  // specifier locs are handled separately below.
   Finder->addMatcher(
   typeLoc(IsInMovedNs,
   loc(qualType(hasDeclaration(DeclMatcher.bind("from_decl",
-  unless(anyOf(hasParent(typeLoc(
-   loc(qualType(hasDeclaration(DeclMatcher),
+  unless(anyOf(hasParent(typeLoc(loc(qualType(
+   allOf(hasDeclaration(DeclMatcher),
+ unless(templateSpecializationType())),
hasParent(nestedNameSpecifierLoc(,
   hasAncestor(decl().bind("dc")))
   .bind("type"),

Modified: 
clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp?rev=285549&r1=285548&r2=285549&view=diff
==
--- clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp 
(original)
+++ clang-tools-extra/trunk/unittests/change-namespace/ChangeNamespaceTests.cpp 
Mon Oct 31 03:28:29 2016
@@ -190,6 +190,47 @@ TEST_F(ChangeNamespaceTest, SimpleMoveWi
   EXPECT_EQ(format(Expected), runChangeNamespaceOnCode(Code));
 }
 
+TEST_F(ChangeNamespaceTest, TypeLocInTemplateSpecialization) {
+  std::string Code = "namespace na {\n"
+ "class A {};\n"
+ "template \n"
+ "class B {};\n"
+ "template \n"
+ "class Two {};\n"
+ "namespace nc { class C {}; }\n"
+ "} // na\n"
+ "\n"
+ "namespace na {\n"
+ "namespace nb {\n"
+ "void f() {\n"
+ "  B b;\n"
+ "  B b_c;\n"
+ "  Two two;\n"
+ "}\n"
+ "} // nb\n"
+ "} // na\n";
+  std::string Expected = "namespace na {\n"
+ "class A {};\n"
+ "template \n"
+ "class B {};\n"
+ "template \n"
+ "class Two {};\n"
+ "namespace nc { class C {}; }\n"
+ "} // na\n"
+ "\n"
+ "\n"
+ "namespace x {\n"
+ "namespace y {\n"
+ "void f() {\n"
+ "  na::B b;\n"
+ "  na::B b_c;\n"
+ "  na::Two two;\n"
+ "}\n"
+ "} // namespace y\n"
+ "} // namespace x\n";
+  EXPECT_EQ(format(Expected), runChangeNamespaceOnCode(Code));
+}
+
 TEST_F(ChangeNamespaceTest, LeaveForwardDeclarationBehind) {
   std::string Code = "namespace na {\n"
  "namespace nb {\n"


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


[libcxx] r285550 - Change from "XFAIL: libcpp-no-exceptions" to "UNSUPPORTED: libcpp-no-exceptions" tests that only check exceptions and nothing else

2016-10-31 Thread Roger Ferrer Ibanez via cfe-commits
Author: rogfer01
Date: Mon Oct 31 03:47:53 2016
New Revision: 285550

URL: http://llvm.org/viewvc/llvm-project?rev=285550&view=rev
Log:
Change from "XFAIL: libcpp-no-exceptions" to "UNSUPPORTED: 
libcpp-no-exceptions" tests that only check exceptions and nothing else

This is a follow up of D24562.

These tests do not check anything but exceptions, so it makes sense to mark
them as UNSUPPORTED under a library built without exceptions.

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


Modified:
libcxx/trunk/test/libcxx/containers/sequences/vector/asan_throw.pass.cpp

libcxx/trunk/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default_throws_bad_alloc.pass.cpp

libcxx/trunk/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp

libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/push_back_exception_safety.pass.cpp

libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/push_front_exception_safety.pass.cpp

libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_exception_safety.pass.cpp

libcxx/trunk/test/std/containers/sequences/list/list.modifiers/push_back_exception_safety.pass.cpp

libcxx/trunk/test/std/containers/sequences/list/list.modifiers/push_front_exception_safety.pass.cpp

libcxx/trunk/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp

libcxx/trunk/test/std/language.support/support.exception/except.nested/rethrow_nested.pass.cpp

libcxx/trunk/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp

libcxx/trunk/test/std/language.support/support.exception/propagation/current_exception.pass.cpp

libcxx/trunk/test/std/language.support/support.exception/propagation/make_exception_ptr.pass.cpp

libcxx/trunk/test/std/language.support/support.exception/propagation/rethrow_exception.pass.cpp

libcxx/trunk/test/std/language.support/support.exception/uncaught/uncaught_exception.pass.cpp

libcxx/trunk/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp
libcxx/trunk/test/std/strings/basic.string/string.capacity/max_size.pass.cpp

libcxx/trunk/test/std/strings/basic.string/string.capacity/over_max_size.pass.cpp

libcxx/trunk/test/std/thread/thread.condition/thread.condition.condvarany/wait_terminates.sh.cpp

libcxx/trunk/test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp

libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator_throw.pass.cpp

libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp

libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator_throw.pass.cpp

libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp

libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_throw.pass.cpp

Modified: 
libcxx/trunk/test/libcxx/containers/sequences/vector/asan_throw.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/containers/sequences/vector/asan_throw.pass.cpp?rev=285550&r1=285549&r2=285550&view=diff
==
--- libcxx/trunk/test/libcxx/containers/sequences/vector/asan_throw.pass.cpp 
(original)
+++ libcxx/trunk/test/libcxx/containers/sequences/vector/asan_throw.pass.cpp 
Mon Oct 31 03:47:53 2016
@@ -7,7 +7,7 @@
 //
 
//===--===//
 
-// XFAIL: libcpp-no-exceptions
+// UNSUPPORTED: libcpp-no-exceptions
 // Test asan vector annotations with a class that throws in a CTOR.
 
 #include 

Modified: 
libcxx/trunk/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default_throws_bad_alloc.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default_throws_bad_alloc.pass.cpp?rev=285550&r1=285549&r2=285550&view=diff
==
--- 
libcxx/trunk/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default_throws_bad_alloc.pass.cpp
 (original)
+++ 
libcxx/trunk/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default_throws_bad_alloc.pass.cpp
 Mon Oct 31 03:47:53 2016
@@ -7,7 +7,7 @@
 //
 
//===--===//
 
-// XFAIL: libcpp-no-exceptions
+// UNSUPPORTED: libcpp-no-exceptions
 // dynarray.cons
 
 // explicit dynarray(size_type c);

Modified: 
libcxx/trunk/test/libcxx/experimental/containers/sequences/dynarray/d

[PATCH] D26075: Change from "XFAIL: libcpp-no-exceptions" to "UNSUPPORTED: libcpp-no-exceptions" tests that only check exceptions and nothing else

2016-10-31 Thread Roger Ferrer Ibanez via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL285550: Change from "XFAIL: libcpp-no-exceptions" to 
"UNSUPPORTED: libcpp-no… (authored by rogfer01).

Changed prior to commit:
  https://reviews.llvm.org/D26075?vs=76190&id=76360#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D26075

Files:
  libcxx/trunk/test/libcxx/containers/sequences/vector/asan_throw.pass.cpp
  
libcxx/trunk/test/libcxx/experimental/containers/sequences/dynarray/dynarray.cons/default_throws_bad_alloc.pass.cpp
  
libcxx/trunk/test/libcxx/experimental/containers/sequences/dynarray/dynarray.overview/at.pass.cpp
  
libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/push_back_exception_safety.pass.cpp
  
libcxx/trunk/test/std/containers/sequences/deque/deque.modifiers/push_front_exception_safety.pass.cpp
  
libcxx/trunk/test/std/containers/sequences/forwardlist/forwardlist.modifiers/push_front_exception_safety.pass.cpp
  
libcxx/trunk/test/std/containers/sequences/list/list.modifiers/push_back_exception_safety.pass.cpp
  
libcxx/trunk/test/std/containers/sequences/list/list.modifiers/push_front_exception_safety.pass.cpp
  
libcxx/trunk/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp
  
libcxx/trunk/test/std/language.support/support.exception/except.nested/rethrow_nested.pass.cpp
  
libcxx/trunk/test/std/language.support/support.exception/except.nested/throw_with_nested.pass.cpp
  
libcxx/trunk/test/std/language.support/support.exception/propagation/current_exception.pass.cpp
  
libcxx/trunk/test/std/language.support/support.exception/propagation/make_exception_ptr.pass.cpp
  
libcxx/trunk/test/std/language.support/support.exception/propagation/rethrow_exception.pass.cpp
  
libcxx/trunk/test/std/language.support/support.exception/uncaught/uncaught_exception.pass.cpp
  
libcxx/trunk/test/std/language.support/support.exception/uncaught/uncaught_exceptions.pass.cpp
  libcxx/trunk/test/std/strings/basic.string/string.capacity/max_size.pass.cpp
  
libcxx/trunk/test/std/strings/basic.string/string.capacity/over_max_size.pass.cpp
  
libcxx/trunk/test/std/thread/thread.condition/thread.condition.condvarany/wait_terminates.sh.cpp
  
libcxx/trunk/test/std/utilities/memory/default.allocator/allocator.members/allocate.size.pass.cpp
  
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator_throw.pass.cpp
  
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp
  
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator_throw.pass.cpp
  
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp
  
libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_throw.pass.cpp

Index: libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator_throw.pass.cpp
===
--- libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator_throw.pass.cpp
+++ libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator_throw.pass.cpp
@@ -7,7 +7,7 @@
 //
 //===--===//
 
-// XFAIL: libcpp-no-exceptions
+// UNSUPPORTED: libcpp-no-exceptions
 // 
 
 // template shared_ptr(nullptr_t, D d, A a);
Index: libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp
===
--- libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp
+++ libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp
@@ -7,7 +7,7 @@
 //
 //===--===//
 
-// XFAIL: libcpp-no-exceptions
+// UNSUPPORTED: libcpp-no-exceptions
 // UNSUPPORTED: sanitizer-new-delete
 
 // 
Index: libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp
===
--- libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp
+++ libcxx/trunk/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp
@@ -7,7 +7,7 @@
 //
 //===--

[PATCH] D26132: [clang-format] Skip over AnnotatedLines with >50 levels of nesting.

2016-10-31 Thread Daniel Jasper via cfe-commits
djasper accepted this revision.
djasper added a comment.
This revision is now accepted and ready to land.

Looks good.


https://reviews.llvm.org/D26132



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


[PATCH] D26057: [coroutines] Add CoawaitDependentExpr AST node and use it to properly build await_transform.

2016-10-31 Thread Alexey Bataev via cfe-commits
ABataev added inline comments.



Comment at: include/clang/AST/ExprCXX.h:4265
+  CoawaitDependentExpr(SourceLocation KeywordLoc, QualType Ty, Expr *Op,
+   UnresolvedSet<16> OperatorCandidates)
+  : Expr(CoawaitDependentExprClass, Ty, VK_RValue, OK_Ordinary, true, true,

`const UnresolvedSetImpl &`



Comment at: include/clang/AST/ExprCXX.h:4266-4267
+   UnresolvedSet<16> OperatorCandidates)
+  : Expr(CoawaitDependentExprClass, Ty, VK_RValue, OK_Ordinary, true, true,
+ true, Op->containsUnexpandedParameterPack()),
+KeywordLoc(KeywordLoc), Operand(Op),

Add comments with the name of params on `true` args



Comment at: include/clang/AST/ExprCXX.h:4277
+
+  Expr *getOperand() const { return static_cast(Operand); }
+

s/static_cast/cast/g



Comment at: include/clang/AST/ExprCXX.h:4279
+
+  const UnresolvedSet<16> &getOperatorCandidates() const {
+return CoawaitOperatorCandidates;

`const UnresolvedSetImpl &`



Comment at: include/clang/Sema/Sema.h:8040
+  BuildCoawaitDependentExpr(SourceLocation KwLoc, Expr *E,
+const UnresolvedSet<16> 
&CoawaitOperatorCandidates);
   ExprResult BuildCoyieldExpr(SourceLocation KwLoc, Expr *E);

`const UnresolvedSetImpl &`



Comment at: lib/Sema/SemaCoroutine.cpp:82
 
   CXXRecordDecl *RD = CoroTrait->getAsCXXRecordDecl();
   assert(RD && "specialization of class template is not a class?");

`auto *RD`



Comment at: lib/Sema/SemaCoroutine.cpp:237-244
+static UnresolvedSet<16> lookupOperatorCoawaitCall(Sema &SemaRef, Scope *S,
+   SourceLocation Loc,
+   Expr *E) {
   UnresolvedSet<16> Functions;
   SemaRef.LookupOverloadedOperatorName(OO_Coawait, S, E->getType(), QualType(),
Functions);
+  return Functions;

Maybe it is better to add an argument `UnresolvedSetImpl &OpCandidates`?



Comment at: lib/Sema/SemaCoroutine.cpp:250
+   Expr *E,
+   const UnresolvedSet<16> &Functions) 
{
   return SemaRef.CreateOverloadedUnaryOp(Loc, UO_Coawait, Functions, E);

`const UnresolvedSetImpl &Functions`



Comment at: lib/Sema/SemaCoroutine.cpp:301
+   SourceLocation Loc, StringRef Name,
+   MutableArrayRef Args) {
+  assert(Coroutine->CoroutinePromise && "no promise for coroutine");

Why do you need `MutableArrayRef`, when `ArrayRef` is enough? 
Also `buildMemberCall` must be changed



Comment at: lib/Sema/SemaCoroutine.cpp:331
+ExprResult
+Sema::BuildCoawaitDependentExpr(SourceLocation Loc, Expr *E,
+const UnresolvedSet<16> &Candidates) {

s/BuildCoawaitDependentExpr/buildCoawaitDependentExpr/g



Comment at: lib/Sema/SemaCoroutine.cpp:332
+Sema::BuildCoawaitDependentExpr(SourceLocation Loc, Expr *E,
+const UnresolvedSet<16> &Candidates) {
+  auto *Coroutine = checkCoroutineContext(*this, Loc, "co_await");

`const UnresolvedSetImpl &`



Comment at: lib/Sema/SemaCoroutine.cpp:352
+
+  CXXRecordDecl *RD = Promise->getType()->getAsCXXRecordDecl();
+  if (lookupMember(*this, "await_transform", RD, Loc)) {

`auto *RD`



Comment at: lib/Sema/TreeTransform.h:1327
+ Expr *Result,
+ const UnresolvedSet<16> &Candidates) {
+return getSema().BuildCoawaitDependentExpr(CoawaitLoc, Result, Candidates);

`const UnresolvedSetImpl &`


https://reviews.llvm.org/D26057



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


[PATCH] D26136: Protect exceptional path under libcpp-no-exceptions

2016-10-31 Thread Roger Ferrer Ibanez via cfe-commits
rogfer01 created this revision.
rogfer01 added reviewers: EricWF, mclow.lists, rmaprath.
rogfer01 added a subscriber: cfe-commits.

This is another followup of https://reviews.llvm.org/D24562

These tests are of the form

  try {
 action-that-may-throw
 assert(!exceptional-condition)
 assert(some-other-facts)
   } catch (relevant-exception) {
 assert(exceptional-condition)
   }

Under libcpp-no-exceptions there is still value in verifying
some-other-facts while avoiding the exceptional case. So for these tests
just conditionally check some-other-facts if exceptional-condition is
false.


https://reviews.llvm.org/D26136

Files:
  test/std/strings/basic.string/string.access/at.pass.cpp
  test/std/strings/basic.string/string.capacity/reserve.pass.cpp
  test/std/strings/basic.string/string.capacity/resize_size.pass.cpp
  test/std/strings/basic.string/string.capacity/resize_size_char.pass.cpp
  test/std/strings/basic.string/string.cons/substr.pass.cpp
  
test/std/strings/basic.string/string.modifiers/string_append/T_size_size.pass.cpp
  
test/std/strings/basic.string/string.modifiers/string_append/string_size_size.pass.cpp
  
test/std/strings/basic.string/string.modifiers/string_assign/T_size_size.pass.cpp
  
test/std/strings/basic.string/string.modifiers/string_assign/string_size_size.pass.cpp
  test/std/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp
  test/std/strings/basic.string/string.modifiers/string_erase/size_size.pass.cpp
  
test/std/strings/basic.string/string.modifiers/string_insert/size_T_size_size.pass.cpp
  
test/std/strings/basic.string/string.modifiers/string_insert/size_pointer.pass.cpp
  
test/std/strings/basic.string/string.modifiers/string_insert/size_pointer_size.pass.cpp
  
test/std/strings/basic.string/string.modifiers/string_insert/size_size_char.pass.cpp
  
test/std/strings/basic.string/string.modifiers/string_insert/size_string.pass.cpp
  
test/std/strings/basic.string/string.modifiers/string_insert/size_string_size_size.pass.cpp
  
test/std/strings/basic.string/string.modifiers/string_replace/size_size_T_size_size.pass.cpp
  
test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer.pass.cpp
  
test/std/strings/basic.string/string.modifiers/string_replace/size_size_pointer_size.pass.cpp
  
test/std/strings/basic.string/string.modifiers/string_replace/size_size_size_char.pass.cpp
  
test/std/strings/basic.string/string.modifiers/string_replace/size_size_string.pass.cpp
  
test/std/strings/basic.string/string.modifiers/string_replace/size_size_string_size_size.pass.cpp
  
test/std/strings/basic.string/string.ops/string_compare/size_size_T_size_size.pass.cpp
  
test/std/strings/basic.string/string.ops/string_compare/size_size_pointer.pass.cpp
  
test/std/strings/basic.string/string.ops/string_compare/size_size_pointer_size.pass.cpp
  
test/std/strings/basic.string/string.ops/string_compare/size_size_string.pass.cpp
  
test/std/strings/basic.string/string.ops/string_compare/size_size_string_size_size.pass.cpp

Index: test/std/strings/basic.string/string.ops/string_compare/size_size_string_size_size.pass.cpp
===
--- test/std/strings/basic.string/string.ops/string_compare/size_size_string_size_size.pass.cpp
+++ test/std/strings/basic.string/string.ops/string_compare/size_size_string_size_size.pass.cpp
@@ -7,7 +7,6 @@
 //
 //===--===//
 
-// XFAIL: libcpp-no-exceptions
 // 
 
 // int compare(size_type pos1, size_type n1, const basic_string& str,
@@ -20,6 +19,8 @@
 
 #include "min_allocator.h"
 
+#include "test_macros.h"
+
 int sign(int x)
 {
 if (x == 0)
@@ -34,6 +35,7 @@
 test(const S& s,   typename S::size_type pos1, typename S::size_type n1,
  const S& str, typename S::size_type pos2, typename S::size_type n2, int x)
 {
+#ifndef TEST_HAS_NO_EXCEPTIONS
 try
 {
 assert(sign(s.compare(pos1, n1, str, pos2, n2)) == sign(x));
@@ -44,13 +46,18 @@
 {
 assert(pos1 > s.size() || pos2 > str.size());
 }
+#else
+if (pos1 <= s.size() && pos2 <= str.size())
+assert(sign(s.compare(pos1, n1, str, pos2, n2)) == sign(x));
+#endif
 }
 
 template 
 void
 test_npos(const S& s,   typename S::size_type pos1, typename S::size_type n1,
   const S& str, typename S::size_type pos2, int x)
 {
+#ifndef TEST_HAS_NO_EXCEPTIONS
 try
 {
 assert(sign(s.compare(pos1, n1, str, pos2)) == sign(x));
@@ -61,6 +68,10 @@
 {
 assert(pos1 > s.size() || pos2 > str.size());
 }
+#else
+if (pos1 <= s.size() && pos2 <= str.size())
+assert(sign(s.compare(pos1, n1, str, pos2)) == sign(x));
+#endif
 }
 
 template 
Index: test/std/strings/basic.string/string.ops/string_compare/size_size_string.pass.cpp
===
--- test/std/strings/basic.string/string.ops/string_compare/size_size_string.pass.cpp
++

[PATCH] D26136: Protect exceptional path under libcpp-no-exceptions

2016-10-31 Thread Asiri Rathnayake via cfe-commits
rmaprath added inline comments.



Comment at: test/std/strings/basic.string/string.access/at.pass.cpp:41
+const S& cs = s;
+if (pos < cs.size())
+{

For the cases where an exception //should've been// thrown, are we not entering 
the **undefined** domain at this point?

What if instead, we define two versions of the `test()` function? one 
containing the current code as-is, and the other only handles the cases where 
exceptions are not expected, and we modify the `main()` function below so that 
the correct `test()` case is invoked depending on the presence  / absence of 
exceptions? It's a bit more cumbersome than the current setup, but I'm not 
totally happy about treading into the undefined domain (if my understanding 
above is correct). 


https://reviews.llvm.org/D26136



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


r285555 - [x86][inline-asm] Introducing (AVX512) k0-k7 registers for inline-asm usage

2016-10-31 Thread Michael Zuckerman via cfe-commits
Author: mzuckerm
Date: Mon Oct 31 04:37:59 2016
New Revision: 28

URL: http://llvm.org/viewvc/llvm-project?rev=28&view=rev
Log:
[x86][inline-asm] Introducing (AVX512) k0-k7 registers for inline-asm usage

Commit on behalf of mharoush 

After LGTM and check all: 
This patch enables usage of k registers in inline assembly syntax.

Reviewer: 1. rnk
  2. delena 

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


Added:
cfe/trunk/test/CodeGen/avx512-inline-asm-kregisters-basics.c
Modified:
cfe/trunk/lib/Basic/Targets.cpp

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=28&r1=285554&r2=28&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Mon Oct 31 04:37:59 2016
@@ -2397,6 +2397,7 @@ static const char* const GCCRegNames[] =
   "zmm8", "zmm9", "zmm10", "zmm11", "zmm12", "zmm13", "zmm14", "zmm15",
   "zmm16", "zmm17", "zmm18", "zmm19", "zmm20", "zmm21", "zmm22", "zmm23",
   "zmm24", "zmm25", "zmm26", "zmm27", "zmm28", "zmm29", "zmm30", "zmm31",
+  "k0", "k1", "k2", "k3", "k4", "k5", "k6", "k7",
 };
 
 const TargetInfo::AddlRegName AddlRegNames[] = {

Added: cfe/trunk/test/CodeGen/avx512-inline-asm-kregisters-basics.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512-inline-asm-kregisters-basics.c?rev=28&view=auto
==
--- cfe/trunk/test/CodeGen/avx512-inline-asm-kregisters-basics.c (added)
+++ cfe/trunk/test/CodeGen/avx512-inline-asm-kregisters-basics.c Mon Oct 31 
04:37:59 2016
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 %s -target-cpu skylake-avx512 -O0  -S -o - -Wall -Werror | 
FileCheck %s
+// This test checks basic inline assembly recognition of k0-k7 registers for 
avx512.
+
+void test_basic_inline_asm_with_k_regs() {
+//CHECK: #APP
+//CHECK: kandw %k1, %k2, %k3
+//CHECK: #NO_APP
+asm("kandw %k1, %k2, %k3\t");
+//CHECK: #APP
+//CHECK: kandw %k4, %k5, %k6
+//CHECK: #NO_APP
+asm("kandw %k4, %k5, %k6\t");
+//CHECK: #APP
+//CHECK: kandw %k7, %k0, %k1
+//CHECK: #NO_APP
+asm("kandw %k7, %k0, %k1\t");
+}
\ No newline at end of file


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


[PATCH] D25011: [x86][inline-asm] Introducing (AVX512) k0-k7 registers for inline-asm usage

2016-10-31 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL28: [x86][inline-asm] Introducing (AVX512) k0-k7 
registers for inline-asm usage (authored by mzuckerm).

Changed prior to commit:
  https://reviews.llvm.org/D25011?vs=72787&id=76370#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25011

Files:
  cfe/trunk/lib/Basic/Targets.cpp
  cfe/trunk/test/CodeGen/avx512-inline-asm-kregisters-basics.c


Index: cfe/trunk/lib/Basic/Targets.cpp
===
--- cfe/trunk/lib/Basic/Targets.cpp
+++ cfe/trunk/lib/Basic/Targets.cpp
@@ -2397,6 +2397,7 @@
   "zmm8", "zmm9", "zmm10", "zmm11", "zmm12", "zmm13", "zmm14", "zmm15",
   "zmm16", "zmm17", "zmm18", "zmm19", "zmm20", "zmm21", "zmm22", "zmm23",
   "zmm24", "zmm25", "zmm26", "zmm27", "zmm28", "zmm29", "zmm30", "zmm31",
+  "k0", "k1", "k2", "k3", "k4", "k5", "k6", "k7",
 };
 
 const TargetInfo::AddlRegName AddlRegNames[] = {
Index: cfe/trunk/test/CodeGen/avx512-inline-asm-kregisters-basics.c
===
--- cfe/trunk/test/CodeGen/avx512-inline-asm-kregisters-basics.c
+++ cfe/trunk/test/CodeGen/avx512-inline-asm-kregisters-basics.c
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 %s -target-cpu skylake-avx512 -O0  -S -o - -Wall -Werror | 
FileCheck %s
+// This test checks basic inline assembly recognition of k0-k7 registers for 
avx512.
+
+void test_basic_inline_asm_with_k_regs() {
+//CHECK: #APP
+//CHECK: kandw %k1, %k2, %k3
+//CHECK: #NO_APP
+asm("kandw %k1, %k2, %k3\t");
+//CHECK: #APP
+//CHECK: kandw %k4, %k5, %k6
+//CHECK: #NO_APP
+asm("kandw %k4, %k5, %k6\t");
+//CHECK: #APP
+//CHECK: kandw %k7, %k0, %k1
+//CHECK: #NO_APP
+asm("kandw %k7, %k0, %k1\t");
+}
\ No newline at end of file


Index: cfe/trunk/lib/Basic/Targets.cpp
===
--- cfe/trunk/lib/Basic/Targets.cpp
+++ cfe/trunk/lib/Basic/Targets.cpp
@@ -2397,6 +2397,7 @@
   "zmm8", "zmm9", "zmm10", "zmm11", "zmm12", "zmm13", "zmm14", "zmm15",
   "zmm16", "zmm17", "zmm18", "zmm19", "zmm20", "zmm21", "zmm22", "zmm23",
   "zmm24", "zmm25", "zmm26", "zmm27", "zmm28", "zmm29", "zmm30", "zmm31",
+  "k0", "k1", "k2", "k3", "k4", "k5", "k6", "k7",
 };
 
 const TargetInfo::AddlRegName AddlRegNames[] = {
Index: cfe/trunk/test/CodeGen/avx512-inline-asm-kregisters-basics.c
===
--- cfe/trunk/test/CodeGen/avx512-inline-asm-kregisters-basics.c
+++ cfe/trunk/test/CodeGen/avx512-inline-asm-kregisters-basics.c
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 %s -target-cpu skylake-avx512 -O0  -S -o - -Wall -Werror | FileCheck %s
+// This test checks basic inline assembly recognition of k0-k7 registers for avx512.
+
+void test_basic_inline_asm_with_k_regs() {
+//CHECK: #APP
+//CHECK: kandw %k1, %k2, %k3
+//CHECK: #NO_APP
+asm("kandw %k1, %k2, %k3\t");
+//CHECK: #APP
+//CHECK: kandw %k4, %k5, %k6
+//CHECK: #NO_APP
+asm("kandw %k4, %k5, %k6\t");
+//CHECK: #APP
+//CHECK: kandw %k7, %k0, %k1
+//CHECK: #NO_APP
+asm("kandw %k7, %k0, %k1\t");
+}
\ No newline at end of file
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D26136: Protect exceptional path under libcpp-no-exceptions

2016-10-31 Thread Roger Ferrer Ibanez via cfe-commits
rogfer01 added inline comments.



Comment at: test/std/strings/basic.string/string.access/at.pass.cpp:41
+const S& cs = s;
+if (pos < cs.size())
+{

rmaprath wrote:
> For the cases where an exception //should've been// thrown, are we not 
> entering the **undefined** domain at this point?
> 
> What if instead, we define two versions of the `test()` function? one 
> containing the current code as-is, and the other only handles the cases where 
> exceptions are not expected, and we modify the `main()` function below so 
> that the correct `test()` case is invoked depending on the presence  / 
> absence of exceptions? It's a bit more cumbersome than the current setup, but 
> I'm not totally happy about treading into the undefined domain (if my 
> understanding above is correct). 
If I understand this test correctly, it checks for the `at` member function. 
While certainly binding a const reference might throw, here it is bound to a 
lvalue of the same type so no temporary construction should happen.

The original test checks both `s.size()` and `cs.size()`. Given that `size` is 
a const member function it probably does not matter given that `cs` and `s` are 
aliased, but see comment below.



Comment at: test/std/strings/basic.string/string.access/at.pass.cpp:45
+assert(cs.at(pos) == cs[pos]);
+assert(pos < cs.size());
+}

This is redundant, maybe I should change the if condition to be `if (pos < 
s.size())`


https://reviews.llvm.org/D26136



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


[PATCH] D26137: [clang-tidy] Add check name to YAML export

2016-10-31 Thread Alpha Abdoulaye via cfe-commits
Alpha created this revision.
Alpha added reviewers: alexfh, klimek, djasper.
Alpha added a subscriber: cfe-commits.
Herald added subscribers: fhahn, mgorny.

Add a field indicating the associated check for every replacement to the YAML 
report generated with the '-export-fixes' option.
Update clang-apply-replacements to handle the new format.

Follow-up to https://reviews.llvm.org/D16183


https://reviews.llvm.org/D26137

Files:
  llvm/tools/clang/include/clang/Tooling/Core/Diagnostic.h
  llvm/tools/clang/include/clang/Tooling/DiagnosticsYaml.h
  llvm/tools/clang/lib/Tooling/Core/CMakeLists.txt
  llvm/tools/clang/lib/Tooling/Core/Diagnostic.cpp
  
llvm/tools/clang/tools/extra/clang-apply-replacements/include/clang-apply-replacements/Tooling/ApplyReplacements.h
  
llvm/tools/clang/tools/extra/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
  llvm/tools/clang/tools/extra/clang-tidy/ClangTidy.cpp
  llvm/tools/clang/tools/extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
  llvm/tools/clang/tools/extra/clang-tidy/ClangTidyDiagnosticConsumer.h

Index: llvm/tools/clang/lib/Tooling/Core/Diagnostic.cpp
===
--- llvm/tools/clang/lib/Tooling/Core/Diagnostic.cpp
+++ llvm/tools/clang/lib/Tooling/Core/Diagnostic.cpp
@@ -0,0 +1,43 @@
+//===--- Diagnostic.cpp - Framework for clang diagnostics tools --===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+//
+//  Implements classes to support/store diagnostics refactoring.
+//
+//===--===//
+
+#include "clang/Tooling/Core/Diagnostic.h"
+#include "clang/Basic/SourceManager.h"
+
+namespace clang {
+namespace tooling {
+
+DiagnosticMessage::DiagnosticMessage(llvm::StringRef Message)
+: Message(Message), FileOffset(0) {}
+
+DiagnosticMessage::DiagnosticMessage(llvm::StringRef Message,
+ const SourceManager &Sources,
+ SourceLocation Loc)
+: Message(Message) {
+  assert(Loc.isValid() && Loc.isFileID());
+  FilePath = Sources.getFilename(Loc);
+  FileOffset = Sources.getFileOffset(Loc);
+}
+
+Diagnostic::Diagnostic(llvm::StringRef CheckName, Diagnostic::Level DiagLevel)
+: CheckName(CheckName), DiagLevel(DiagLevel) {}
+
+Diagnostic::Diagnostic(llvm::StringRef CheckName, DiagnosticMessage &Message,
+   llvm::StringMap &Fix,
+   SmallVector &Notes,
+   Level DiagLevel)
+: CheckName(CheckName), Message(Message), Fix(Fix), Notes(Notes),
+  DiagLevel(DiagLevel) {}
+
+} // end namespace tooling
+} // end namespace clang
Index: llvm/tools/clang/lib/Tooling/Core/CMakeLists.txt
===
--- llvm/tools/clang/lib/Tooling/Core/CMakeLists.txt
+++ llvm/tools/clang/lib/Tooling/Core/CMakeLists.txt
@@ -4,7 +4,8 @@
   Lookup.cpp
   Replacement.cpp
   QualTypeNames.cpp
+  Diagnostic.cpp

   LINK_LIBS
   clangAST
   clangBasic
Index: llvm/tools/clang/include/clang/Tooling/DiagnosticsYaml.h
===
--- llvm/tools/clang/include/clang/Tooling/DiagnosticsYaml.h
+++ llvm/tools/clang/include/clang/Tooling/DiagnosticsYaml.h
@@ -0,0 +1,81 @@
+//===-- DiagnosticsYaml.h -- Serialiazation for Diagnosticss ---*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+///
+/// \file
+/// \brief This file defines the structure of a YAML document for serializing
+/// diagnostics.
+///
+//===--===//
+
+#ifndef LLVM_CLANG_TOOLING_DIAGNOSTICSYAML_H
+#define LLVM_CLANG_TOOLING_DIAGNOSTICSYAML_H
+
+#include "clang/Tooling/Core/Diagnostic.h"
+#include "clang/Tooling/ReplacementsYaml.h"
+#include "llvm/Support/YAMLTraits.h"
+#include 
+
+LLVM_YAML_IS_SEQUENCE_VECTOR(clang::tooling::Diagnostic)
+
+namespace llvm {
+namespace yaml {
+
+/// \brief Specialized MappingTraits to describe how a Diagnostic is
+/// (de)serialized.
+template <> struct MappingTraits {
+  /// \brief Helper to (de)serialize a Diagnostic since we don't have direct
+  /// access to its data members.
+  class NormalizedDiagnostic {
+  public:
+NormalizedDiagnostic(const IO &)
+: CheckName(""), Message(), Fix(), Notes(), DiagLevel() {}
+
+NormalizedDiagnostic(const IO &, const clang::tooling::Diagnostic &D)
+: CheckName(D.CheckName), Message(Message), Fix(D.Fix), Notes(D.Notes),
+  DiagLevel(D.DiagLevel) {}

[PATCH] D26136: Protect exceptional path under libcpp-no-exceptions

2016-10-31 Thread Asiri Rathnayake via cfe-commits
rmaprath added inline comments.



Comment at: test/std/strings/basic.string/string.access/at.pass.cpp:41
+const S& cs = s;
+if (pos < cs.size())
+{

rogfer01 wrote:
> rmaprath wrote:
> > For the cases where an exception //should've been// thrown, are we not 
> > entering the **undefined** domain at this point?
> > 
> > What if instead, we define two versions of the `test()` function? one 
> > containing the current code as-is, and the other only handles the cases 
> > where exceptions are not expected, and we modify the `main()` function 
> > below so that the correct `test()` case is invoked depending on the 
> > presence  / absence of exceptions? It's a bit more cumbersome than the 
> > current setup, but I'm not totally happy about treading into the undefined 
> > domain (if my understanding above is correct). 
> If I understand this test correctly, it checks for the `at` member function. 
> While certainly binding a const reference might throw, here it is bound to a 
> lvalue of the same type so no temporary construction should happen.
> 
> The original test checks both `s.size()` and `cs.size()`. Given that `size` 
> is a const member function it probably does not matter given that `cs` and 
> `s` are aliased, but see comment below.
Right, so it's the `at()` method which is expected to throw in this case. What 
you are doing here is carefully avoiding the exception throwing code-path while 
keeping the remaining assertions intact. Makes sense.

I'll go over the rest of the test cases to double check. But I'm happy with 
this.

(You need to wait for approval from @EricWF or @mclow.lists to commit)


https://reviews.llvm.org/D26136



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


r285556 - Revert reviosion 285555

2016-10-31 Thread Michael Zuckerman via cfe-commits
Author: mzuckerm
Date: Mon Oct 31 05:12:36 2016
New Revision: 285556

URL: http://llvm.org/viewvc/llvm-project?rev=285556&view=rev
Log:
Revert reviosion 28

Removed:
cfe/trunk/test/CodeGen/avx512-inline-asm-kregisters-basics.c
Modified:
cfe/trunk/lib/Basic/Targets.cpp

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=285556&r1=28&r2=285556&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Mon Oct 31 05:12:36 2016
@@ -2397,7 +2397,6 @@ static const char* const GCCRegNames[] =
   "zmm8", "zmm9", "zmm10", "zmm11", "zmm12", "zmm13", "zmm14", "zmm15",
   "zmm16", "zmm17", "zmm18", "zmm19", "zmm20", "zmm21", "zmm22", "zmm23",
   "zmm24", "zmm25", "zmm26", "zmm27", "zmm28", "zmm29", "zmm30", "zmm31",
-  "k0", "k1", "k2", "k3", "k4", "k5", "k6", "k7",
 };
 
 const TargetInfo::AddlRegName AddlRegNames[] = {

Removed: cfe/trunk/test/CodeGen/avx512-inline-asm-kregisters-basics.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512-inline-asm-kregisters-basics.c?rev=28&view=auto
==
--- cfe/trunk/test/CodeGen/avx512-inline-asm-kregisters-basics.c (original)
+++ cfe/trunk/test/CodeGen/avx512-inline-asm-kregisters-basics.c (removed)
@@ -1,17 +0,0 @@
-// RUN: %clang_cc1 %s -target-cpu skylake-avx512 -O0  -S -o - -Wall -Werror | 
FileCheck %s
-// This test checks basic inline assembly recognition of k0-k7 registers for 
avx512.
-
-void test_basic_inline_asm_with_k_regs() {
-//CHECK: #APP
-//CHECK: kandw %k1, %k2, %k3
-//CHECK: #NO_APP
-asm("kandw %k1, %k2, %k3\t");
-//CHECK: #APP
-//CHECK: kandw %k4, %k5, %k6
-//CHECK: #NO_APP
-asm("kandw %k4, %k5, %k6\t");
-//CHECK: #APP
-//CHECK: kandw %k7, %k0, %k1
-//CHECK: #NO_APP
-asm("kandw %k7, %k0, %k1\t");
-}
\ No newline at end of file


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


r285557 - [OpenCL] Setting constant address space for array initializers

2016-10-31 Thread Alexey Bader via cfe-commits
Author: bader
Date: Mon Oct 31 05:26:31 2016
New Revision: 285557

URL: http://llvm.org/viewvc/llvm-project?rev=285557&view=rev
Log:
[OpenCL] Setting constant address space for array initializers

Summary: Setting constant address space for global constants used for 
memcpy-initialization of arrays.

Patch by Alexey Sotkin.

Reviewers: bader, yaxunl, Anastasia

Subscribers: cfe-commits, AlexeySotkin

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


Added:
cfe/trunk/test/CodeGenOpenCL/private-array-initialization.cl
Modified:
cfe/trunk/lib/CodeGen/CGDecl.cpp
cfe/trunk/test/CodeGenOpenCL/partial_initializer.cl

Modified: cfe/trunk/lib/CodeGen/CGDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=285557&r1=285556&r2=285557&view=diff
==
--- cfe/trunk/lib/CodeGen/CGDecl.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDecl.cpp Mon Oct 31 05:26:31 2016
@@ -1225,10 +1225,16 @@ void CodeGenFunction::EmitAutoVarInit(co
 // Otherwise, create a temporary global with the initializer then
 // memcpy from the global to the alloca.
 std::string Name = getStaticDeclName(CGM, D);
+unsigned AS = 0;
+if (getLangOpts().OpenCL) {
+  AS = CGM.getContext().getTargetAddressSpace(LangAS::opencl_constant);
+  BP = llvm::PointerType::getInt8PtrTy(getLLVMContext(), AS);
+}
 llvm::GlobalVariable *GV =
   new llvm::GlobalVariable(CGM.getModule(), constant->getType(), true,
llvm::GlobalValue::PrivateLinkage,
-   constant, Name);
+   constant, Name, nullptr,
+   llvm::GlobalValue::NotThreadLocal, AS);
 GV->setAlignment(Loc.getAlignment().getQuantity());
 GV->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::Global);
 

Modified: cfe/trunk/test/CodeGenOpenCL/partial_initializer.cl
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenOpenCL/partial_initializer.cl?rev=285557&r1=285556&r2=285557&view=diff
==
--- cfe/trunk/test/CodeGenOpenCL/partial_initializer.cl (original)
+++ cfe/trunk/test/CodeGenOpenCL/partial_initializer.cl Mon Oct 31 05:26:31 2016
@@ -24,7 +24,7 @@ int4 GV1 = (int4)((int2)(1,2),3,4);
 // CHECK: @GV2 = addrspace(1) global <4 x i32> , 
align 16
 int4 GV2 = (int4)(1);
 
-// CHECK: @f.S = private unnamed_addr constant %struct.StrucTy { i32 1, i32 2, 
i32 0 }, align 4
+// CHECK: @f.S = private unnamed_addr addrspace(2) constant %struct.StrucTy { 
i32 1, i32 2, i32 0 }, align 4
 
 // CHECK-LABEL: define spir_func void @f()
 void f(void) {
@@ -46,7 +46,7 @@ void f(void) {
   float A[6][6]  = {1.0f, 2.0f};
 
   // CHECK: %[[v5:.*]] = bitcast %struct.StrucTy* %S to i8*
-  // CHECK: call void @llvm.memcpy.p0i8.p0i8.i32(i8* %[[v5]], i8* bitcast 
(%struct.StrucTy* @f.S to i8*), i32 12, i32 4, i1 false)
+  // CHECK: call void @llvm.memcpy.p0i8.p2i8.i32(i8* %[[v5]], i8 addrspace(2)* 
bitcast (%struct.StrucTy addrspace(2)* @f.S to i8 addrspace(2)*), i32 12, i32 
4, i1 false)
   StrucTy S = {1, 2};
 
   // CHECK: store <2 x i32> , <2 x i32>* %[[compoundliteral1]], 
align 8

Added: cfe/trunk/test/CodeGenOpenCL/private-array-initialization.cl
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenOpenCL/private-array-initialization.cl?rev=285557&view=auto
==
--- cfe/trunk/test/CodeGenOpenCL/private-array-initialization.cl (added)
+++ cfe/trunk/test/CodeGenOpenCL/private-array-initialization.cl Mon Oct 31 
05:26:31 2016
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -O0 -emit-llvm -o - | 
FileCheck %s
+
+// CHECK: @test.arr = private unnamed_addr addrspace(2) constant [3 x i32] 
[i32 1, i32 2, i32 3], align 4
+
+void test() {
+  __private int arr[] = {1, 2, 3};
+// CHECK:  %[[arr_i8_ptr:[0-9]+]] = bitcast [3 x i32]* %arr to i8*
+// CHECK:  call void @llvm.memcpy.p0i8.p2i8.i32(i8* %[[arr_i8_ptr]], i8 
addrspace(2)* bitcast ([3 x i32] addrspace(2)* @test.arr to i8 addrspace(2)*), 
i32 12, i32 4, i1 false)
+}


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


[PATCH] D25305: [OpenCL] Setting constant address space for array initializers

2016-10-31 Thread Alexey Bader via cfe-commits
bader added a comment.

Committed at 285557 with updated tests.


https://reviews.llvm.org/D25305



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


[PATCH] D26138: [clang-tidy] Add modernize-use-delete check

2016-10-31 Thread Malcolm Parsons via cfe-commits
malcolm.parsons created this revision.
malcolm.parsons added reviewers: aaron.ballman, alexfh, klimek.
malcolm.parsons added subscribers: cfe-commits, danielmarjamaki.
Herald added a subscriber: mgorny.

Fixes PR27872


https://reviews.llvm.org/D26138

Files:
  clang-tidy/modernize/CMakeLists.txt
  clang-tidy/modernize/ModernizeTidyModule.cpp
  clang-tidy/modernize/UseDeleteCheck.cpp
  clang-tidy/modernize/UseDeleteCheck.h
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/modernize-use-delete.rst
  test/clang-tidy/modernize-use-delete.cpp

Index: test/clang-tidy/modernize-use-delete.cpp
===
--- /dev/null
+++ test/clang-tidy/modernize-use-delete.cpp
@@ -0,0 +1,122 @@
+// RUN: %check_clang_tidy %s modernize-use-delete %t
+
+struct PositivePrivate {
+private:
+  PositivePrivate();
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= delete' to prevent a default special member function [modernize-use-delete]
+  // CHECK-FIXES: PositivePrivate() = delete;
+  PositivePrivate(const PositivePrivate &);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= delete' to prevent a default special member function [modernize-use-delete]
+  // CHECK-FIXES: PositivePrivate(const PositivePrivate &) = delete;
+  PositivePrivate &operator=(const PositivePrivate &);
+  // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: use '= delete' to prevent a default special member function [modernize-use-delete]
+  // CHECK-FIXES: PositivePrivate &operator=(const PositivePrivate &) = delete;
+  PositivePrivate(PositivePrivate &&);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= delete' to prevent a default special member function [modernize-use-delete]
+  // CHECK-FIXES: PositivePrivate(PositivePrivate &&) = delete;
+  PositivePrivate &operator=(PositivePrivate &&);
+  // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: use '= delete' to prevent a default special member function [modernize-use-delete]
+  // CHECK-FIXES: PositivePrivate &operator=(PositivePrivate &&) = delete;
+  ~PositivePrivate();
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= delete' to prevent a default special member function [modernize-use-delete]
+  // CHECK-FIXES: ~PositivePrivate() = delete;
+};
+
+struct NegativePublic {
+  NegativePublic(const NegativePublic &);
+};
+
+struct NegativeProtected {
+protected:
+  NegativeProtected(const NegativeProtected &);
+};
+
+struct PositiveInlineMember {
+  int foo() { return 0; }
+
+private:
+  PositiveInlineMember(const PositiveInlineMember &);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= delete' to prevent a default special member function [modernize-use-delete]
+  // CHECK-FIXES: PositiveInlineMember(const PositiveInlineMember &) = delete;
+};
+
+struct PositiveOutOfLineMember {
+  int foo();
+
+private:
+  PositiveOutOfLineMember(const PositiveOutOfLineMember &);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= delete' to prevent a default special member function [modernize-use-delete]
+  // CHECK-FIXES: PositiveOutOfLineMember(const PositiveOutOfLineMember &) = delete;
+};
+
+int PositiveOutOfLineMember::foo() { return 0; }
+
+struct PositiveAbstractMember {
+  virtual int foo() = 0;
+
+private:
+  PositiveAbstractMember(const PositiveAbstractMember &);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= delete' to prevent a default special member function [modernize-use-delete]
+  // CHECK-FIXES: PositiveAbstractMember(const PositiveAbstractMember &) = delete;
+};
+
+struct NegativeMemberNotImpl {
+  int foo();
+
+private:
+  NegativeMemberNotImpl(const NegativeMemberNotImpl &);
+};
+
+struct NegativeStaticMemberNotImpl {
+  static int foo();
+
+private:
+  NegativeStaticMemberNotImpl(const NegativeStaticMemberNotImpl &);
+};
+
+struct NegativeInline {
+private:
+  NegativeInline(const NegativeInline &) {}
+};
+
+struct NegativeOutOfLine {
+private:
+  NegativeOutOfLine(const NegativeOutOfLine &);
+};
+
+NegativeOutOfLine::NegativeOutOfLine(const NegativeOutOfLine &) {}
+
+struct NegativeConstructNotImpl {
+  NegativeConstructNotImpl();
+
+private:
+  NegativeConstructNotImpl(const NegativeConstructNotImpl &);
+};
+
+struct PositiveDefaultedConstruct {
+  PositiveDefaultedConstruct() = default;
+
+private:
+  PositiveDefaultedConstruct(const PositiveDefaultedConstruct &);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= delete' to prevent a default special member function [modernize-use-delete]
+  // CHECK-FIXES: PositiveDefaultedConstruct(const PositiveDefaultedConstruct &) = delete;
+};
+
+struct PositiveDeletedConstruct {
+  PositiveDeletedConstruct() = delete;
+
+private:
+  PositiveDeletedConstruct(const PositiveDeletedConstruct &);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= delete' to prevent a default special member function [modernize-use-delete]
+  // CHECK-FIXES: PositiveDeletedConstruct(const PositiveDeletedConstruct &) = delete;
+};
+
+struct NegativeDefaulted {
+private:
+  NegativeDefaulted(const Neg

[PATCH] D26139: Tests for strings conversions under libcpp-no-exceptions

2016-10-31 Thread Roger Ferrer Ibanez via cfe-commits
rogfer01 created this revision.
rogfer01 added reviewers: mclow.lists, EricWF, rmaprath.
rogfer01 added a subscriber: cfe-commits.

These files have two styles of tests

  // First style
  try {
action
assert(something-expected);
  } catch ( exception ) {
assert(false);
  }
  
  // Second style
  try {
action
assert(false);
  } catch ( exception ) {
assert(something-expected);
  }

Under libcpp-no-exceptions, we still want to run what is inside the try
block (but not the catch) for first style tests. Second style tests are
skipped as a whole.

Conversions from integers only feature second style tests.

The diff is a bit noisy because it still has to skip `try` keywords
for first style tests. I prefer this to adding a magical TEST_TRY macro
here (catch blocks would look weird and introducing a TEST_CASE macro
does not look appealing to me either)


https://reviews.llvm.org/D26139

Files:
  test/std/strings/string.conversions/stod.pass.cpp
  test/std/strings/string.conversions/stof.pass.cpp
  test/std/strings/string.conversions/stoi.pass.cpp
  test/std/strings/string.conversions/stol.pass.cpp
  test/std/strings/string.conversions/stold.pass.cpp
  test/std/strings/string.conversions/stoll.pass.cpp
  test/std/strings/string.conversions/stoul.pass.cpp
  test/std/strings/string.conversions/stoull.pass.cpp

Index: test/std/strings/string.conversions/stoull.pass.cpp
===
--- test/std/strings/string.conversions/stoull.pass.cpp
+++ test/std/strings/string.conversions/stoull.pass.cpp
@@ -7,7 +7,6 @@
 //
 //===--===//
 //
-// XFAIL: libcpp-no-exceptions
 // XFAIL: with_system_cxx_lib=x86_64-apple-darwin11
 // XFAIL: with_system_cxx_lib=x86_64-apple-darwin12
 
@@ -19,6 +18,8 @@
 #include 
 #include 
 
+#include "test_macros.h"
+
 int main()
 {
 assert(std::stoull("0") == 0);
@@ -33,6 +34,7 @@
 idx = 0;
 assert(std::stoull(L"10g", &idx, 16) == 16);
 assert(idx == 2);
+#ifndef TEST_HAS_NO_EXCEPTIONS
 idx = 0;
 try
 {
@@ -108,4 +110,5 @@
 {
 assert(idx == 0);
 }
+#endif
 }
Index: test/std/strings/string.conversions/stoul.pass.cpp
===
--- test/std/strings/string.conversions/stoul.pass.cpp
+++ test/std/strings/string.conversions/stoul.pass.cpp
@@ -7,7 +7,6 @@
 //
 //===--===//
 //
-// XFAIL: libcpp-no-exceptions
 // XFAIL: with_system_cxx_lib=x86_64-apple-darwin11
 // XFAIL: with_system_cxx_lib=x86_64-apple-darwin12
 
@@ -19,6 +18,8 @@
 #include 
 #include 
 
+#include "test_macros.h"
+
 int main()
 {
 assert(std::stoul("0") == 0);
@@ -33,6 +34,7 @@
 idx = 0;
 assert(std::stoul(L"10g", &idx, 16) == 16);
 assert(idx == 2);
+#ifndef TEST_HAS_NO_EXCEPTIONS
 idx = 0;
 try
 {
@@ -107,4 +109,5 @@
 {
 assert(idx == 0);
 }
+#endif
 }
Index: test/std/strings/string.conversions/stoll.pass.cpp
===
--- test/std/strings/string.conversions/stoll.pass.cpp
+++ test/std/strings/string.conversions/stoll.pass.cpp
@@ -7,7 +7,6 @@
 //
 //===--===//
 //
-// XFAIL: libcpp-no-exceptions
 // XFAIL: with_system_cxx_lib=x86_64-apple-darwin11
 // XFAIL: with_system_cxx_lib=x86_64-apple-darwin12
 
@@ -19,6 +18,8 @@
 #include 
 #include 
 
+#include "test_macros.h"
+
 int main()
 {
 assert(std::stoll("0") == 0);
@@ -35,6 +36,7 @@
 idx = 0;
 assert(std::stoll(L"10g", &idx, 16) == 16);
 assert(idx == 2);
+#ifndef TEST_HAS_NO_EXCEPTIONS
 idx = 0;
 try
 {
@@ -108,4 +110,5 @@
 {
 assert(idx == 0);
 }
+#endif
 }
Index: test/std/strings/string.conversions/stold.pass.cpp
===
--- test/std/strings/string.conversions/stold.pass.cpp
+++ test/std/strings/string.conversions/stold.pass.cpp
@@ -7,7 +7,6 @@
 //
 //===--===//
 
-// XFAIL: libcpp-no-exceptions
 // 
 
 // long double stold(const string& str, size_t *idx = 0);
@@ -19,6 +18,8 @@
 #include 
 #include 
 
+#include "test_macros.h"
+
 int main()
 {
 assert(std::stold("0") == 0);
@@ -35,25 +36,32 @@
 idx = 0;
 assert(std::stold(L"10g", &idx) == 10);
 assert(idx == 2);
+#ifndef TEST_HAS_NO_EXCEPTIONS
 try
+#endif
 {
 assert(std::stold("1.e60", &idx) == 1.e60L);
 assert(idx == 5);
 }
+#ifndef TEST_HAS_NO_EXCEPTIONS
 catch (const std::out_of_range&)
 {
 assert(false);
 }
 try
+#endif
 {
 assert(std::stold(L"1.e60", &idx) == 1.e60L);
 assert(idx == 5);
 }
+#ifndef TEST_HAS_NO_EXCEPTIONS
 catch (const std::out_of_range&)
 {
 assert(false);
  

[PATCH] D26141: Protect tests that expect an exception for an unknown std::random_device

2016-10-31 Thread Roger Ferrer Ibanez via cfe-commits
rogfer01 created this revision.
rogfer01 added reviewers: mclow.lists, EricWF, rmaprath.
rogfer01 added a subscriber: cfe-commits.

Skip these tests under libcpp-no-exceptions.


https://reviews.llvm.org/D26141

Files:
  test/std/numerics/rand/rand.device/ctor.pass.cpp
  test/std/numerics/rand/rand.device/eval.pass.cpp


Index: test/std/numerics/rand/rand.device/eval.pass.cpp
===
--- test/std/numerics/rand/rand.device/eval.pass.cpp
+++ test/std/numerics/rand/rand.device/eval.pass.cpp
@@ -7,7 +7,6 @@
 //
 
//===--===//
 
-// XFAIL: libcpp-no-exceptions
 // 
 
 // class random_device;
@@ -26,6 +25,7 @@
 std::random_device::result_type e = r();
 }
 
+#ifndef TEST_HAS_NO_EXCEPTIONS
 try
 {
 std::random_device r("/dev/null");
@@ -35,4 +35,5 @@
 catch (const std::system_error&)
 {
 }
+#endif
 }
Index: test/std/numerics/rand/rand.device/ctor.pass.cpp
===
--- test/std/numerics/rand/rand.device/ctor.pass.cpp
+++ test/std/numerics/rand/rand.device/ctor.pass.cpp
@@ -7,7 +7,6 @@
 //
 
//===--===//
 
-// XFAIL: libcpp-no-exceptions
 // 
 
 // class random_device;
@@ -44,11 +43,13 @@
 }
 
 void check_random_device_invalid(const std::string &token) {
+#ifndef TEST_HAS_NO_EXCEPTIONS
   try {
 std::random_device r(token);
 LIBCPP_ASSERT(false);
   } catch (const std::system_error&) {
   }
+#endif
 }
 
 


Index: test/std/numerics/rand/rand.device/eval.pass.cpp
===
--- test/std/numerics/rand/rand.device/eval.pass.cpp
+++ test/std/numerics/rand/rand.device/eval.pass.cpp
@@ -7,7 +7,6 @@
 //
 //===--===//
 
-// XFAIL: libcpp-no-exceptions
 // 
 
 // class random_device;
@@ -26,6 +25,7 @@
 std::random_device::result_type e = r();
 }
 
+#ifndef TEST_HAS_NO_EXCEPTIONS
 try
 {
 std::random_device r("/dev/null");
@@ -35,4 +35,5 @@
 catch (const std::system_error&)
 {
 }
+#endif
 }
Index: test/std/numerics/rand/rand.device/ctor.pass.cpp
===
--- test/std/numerics/rand/rand.device/ctor.pass.cpp
+++ test/std/numerics/rand/rand.device/ctor.pass.cpp
@@ -7,7 +7,6 @@
 //
 //===--===//
 
-// XFAIL: libcpp-no-exceptions
 // 
 
 // class random_device;
@@ -44,11 +43,13 @@
 }
 
 void check_random_device_invalid(const std::string &token) {
+#ifndef TEST_HAS_NO_EXCEPTIONS
   try {
 std::random_device r(token);
 LIBCPP_ASSERT(false);
   } catch (const std::system_error&) {
   }
+#endif
 }
 
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D26142: Protect std::experimental::optional tests under libcpp-no-exceptions

2016-10-31 Thread Roger Ferrer Ibanez via cfe-commits
rogfer01 created this revision.
rogfer01 added reviewers: mclow.lists, EricWF, rmaprath.
rogfer01 added a subscriber: cfe-commits.

In these tests there are some paths that explicitly throw, so use
the TEST_THROW macro that was proposed for this and then skip the tests
that may enter the throwing path.


https://reviews.llvm.org/D26142

Files:
  
test/std/experimental/optional/optional.object/optional.object.assign/copy.pass.cpp
  
test/std/experimental/optional/optional.object/optional.object.assign/emplace.pass.cpp
  
test/std/experimental/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp
  
test/std/experimental/optional/optional.object/optional.object.assign/move.pass.cpp
  
test/std/experimental/optional/optional.object/optional.object.ctor/const_T.pass.cpp
  
test/std/experimental/optional/optional.object/optional.object.ctor/copy.pass.cpp
  
test/std/experimental/optional/optional.object/optional.object.ctor/in_place_t.pass.cpp
  
test/std/experimental/optional/optional.object/optional.object.ctor/initializer_list.pass.cpp
  
test/std/experimental/optional/optional.object/optional.object.ctor/move.pass.cpp
  
test/std/experimental/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp
  
test/std/experimental/optional/optional.object/optional.object.observe/value.pass.cpp
  
test/std/experimental/optional/optional.object/optional.object.observe/value_const.pass.cpp
  
test/std/experimental/optional/optional.object/optional.object.swap/swap.pass.cpp

Index: test/std/experimental/optional/optional.object/optional.object.swap/swap.pass.cpp
===
--- test/std/experimental/optional/optional.object/optional.object.swap/swap.pass.cpp
+++ test/std/experimental/optional/optional.object/optional.object.swap/swap.pass.cpp
@@ -8,7 +8,6 @@
 //===--===//
 
 // UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: libcpp-no-exceptions
 // 
 
 // void swap(optional&)
@@ -19,6 +18,8 @@
 #include 
 #include 
 
+#include "test_macros.h"
+
 using std::experimental::optional;
 
 class X
@@ -56,10 +57,10 @@
 int i_;
 public:
 Z(int i) : i_(i) {}
-Z(Z&&) {throw 7;}
+Z(Z&&) {TEST_THROW(7);}
 
 friend constexpr bool operator==(const Z& x, const Z& y) {return x.i_ == y.i_;}
-friend void swap(Z& x, Z& y) {throw 6;}
+friend void swap(Z& x, Z& y) {TEST_THROW(6);}
 };
 
 struct ConstSwappable {
@@ -231,6 +232,7 @@
 assert(static_cast(opt2) == true);
 assert(*opt2 == 1);
 }
+#ifndef TEST_HAS_NO_EXCEPTIONS
 {
 optional opt1;
 optional opt2;
@@ -307,4 +309,5 @@
 assert(static_cast(opt2) == true);
 assert(*opt2 == 2);
 }
+#endif
 }
Index: test/std/experimental/optional/optional.object/optional.object.observe/value_const.pass.cpp
===
--- test/std/experimental/optional/optional.object/optional.object.observe/value_const.pass.cpp
+++ test/std/experimental/optional/optional.object/optional.object.observe/value_const.pass.cpp
@@ -8,15 +8,16 @@
 //===--===//
 
 // UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: libcpp-no-exceptions
 // 
 
 // constexpr const T& optional::value() const;
 
 #include 
 #include 
 #include 
 
+#include "test_macros.h"
+
 using std::experimental::optional;
 using std::experimental::in_place_t;
 using std::experimental::in_place;
@@ -40,6 +41,7 @@
 const optional opt(in_place);
 assert(opt.value().test() == 3);
 }
+#ifndef TEST_HAS_NO_EXCEPTIONS
 {
 const optional opt;
 try
@@ -51,4 +53,5 @@
 {
 }
 }
+#endif
 }
Index: test/std/experimental/optional/optional.object/optional.object.observe/value.pass.cpp
===
--- test/std/experimental/optional/optional.object/optional.object.observe/value.pass.cpp
+++ test/std/experimental/optional/optional.object/optional.object.observe/value.pass.cpp
@@ -8,15 +8,16 @@
 //===--===//
 
 // UNSUPPORTED: c++98, c++03, c++11
-// XFAIL: libcpp-no-exceptions
 // 
 
 // T& optional::value();
 
 #include 
 #include 
 #include 
 
+#include "test_macros.h"
+
 using std::experimental::optional;
 using std::experimental::bad_optional_access;
 
@@ -35,6 +36,7 @@
 opt.emplace();
 assert(opt.value().test() == 4);
 }
+#ifndef TEST_HAS_NO_EXCEPTIONS
 {
 optional opt;
 try
@@ -46,4 +48,5 @@
 {
 }
 }
+#endif
 }
Index: test/std/experimental/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp
===
--- test/std/experimental/optional/optional.object/optional.object.ctor/rvalue_T.pass.cpp
+++ test/std/experimenta

[PATCH] D26143: [modules] Mark deleted functions as implicitly inline to allow merging

2016-10-31 Thread Eric Fiselier via cfe-commits
EricWF created this revision.
EricWF added reviewers: rsmith, silvas, manmanren.
EricWF added a subscriber: cfe-commits.

When merging definitions with ModulesLocalVisibility enabled it's important to 
make deleted definitions implicitly inline, otherwise they'll be diagnosed as a 
redefinition.


https://reviews.llvm.org/D26143

Files:
  lib/Sema/SemaDeclCXX.cpp


Index: lib/Sema/SemaDeclCXX.cpp
===
--- lib/Sema/SemaDeclCXX.cpp
+++ lib/Sema/SemaDeclCXX.cpp
@@ -13870,6 +13870,11 @@
   if (Fn->isMain())
 Diag(DelLoc, diag::err_deleted_main);
 
+  // C++11 [dcl.fct.def.delete]p4:
+  //  A deleted function is implicitly inline.
+  // NOTE: Modules cannot correctly merge deleted functions unless they are
+  // inline.
+  Fn->setImplicitlyInline();
   Fn->setDeletedAsWritten();
 }
 


Index: lib/Sema/SemaDeclCXX.cpp
===
--- lib/Sema/SemaDeclCXX.cpp
+++ lib/Sema/SemaDeclCXX.cpp
@@ -13870,6 +13870,11 @@
   if (Fn->isMain())
 Diag(DelLoc, diag::err_deleted_main);
 
+  // C++11 [dcl.fct.def.delete]p4:
+  //  A deleted function is implicitly inline.
+  // NOTE: Modules cannot correctly merge deleted functions unless they are
+  // inline.
+  Fn->setImplicitlyInline();
   Fn->setDeletedAsWritten();
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D26143: [modules] Mark deleted functions as implicitly inline to allow merging

2016-10-31 Thread Eric Fiselier via cfe-commits
EricWF updated this revision to Diff 76384.
EricWF added a comment.

Add test case.


https://reviews.llvm.org/D26143

Files:
  lib/Sema/SemaDeclCXX.cpp
  test/Modules/Inputs/merge-decl-context/a.h


Index: test/Modules/Inputs/merge-decl-context/a.h
===
--- test/Modules/Inputs/merge-decl-context/a.h
+++ test/Modules/Inputs/merge-decl-context/a.h
@@ -24,5 +24,6 @@
 struct Aggregate {
   int member;
 };
+bool operator==(Aggregate, Aggregate) = delete;
 
 #endif
Index: lib/Sema/SemaDeclCXX.cpp
===
--- lib/Sema/SemaDeclCXX.cpp
+++ lib/Sema/SemaDeclCXX.cpp
@@ -13870,6 +13870,11 @@
   if (Fn->isMain())
 Diag(DelLoc, diag::err_deleted_main);
 
+  // C++11 [dcl.fct.def.delete]p4:
+  //  A deleted function is implicitly inline.
+  // NOTE: Modules cannot correctly merge deleted functions unless they are
+  // inline.
+  Fn->setImplicitlyInline();
   Fn->setDeletedAsWritten();
 }
 


Index: test/Modules/Inputs/merge-decl-context/a.h
===
--- test/Modules/Inputs/merge-decl-context/a.h
+++ test/Modules/Inputs/merge-decl-context/a.h
@@ -24,5 +24,6 @@
 struct Aggregate {
   int member;
 };
+bool operator==(Aggregate, Aggregate) = delete;
 
 #endif
Index: lib/Sema/SemaDeclCXX.cpp
===
--- lib/Sema/SemaDeclCXX.cpp
+++ lib/Sema/SemaDeclCXX.cpp
@@ -13870,6 +13870,11 @@
   if (Fn->isMain())
 Diag(DelLoc, diag::err_deleted_main);
 
+  // C++11 [dcl.fct.def.delete]p4:
+  //  A deleted function is implicitly inline.
+  // NOTE: Modules cannot correctly merge deleted functions unless they are
+  // inline.
+  Fn->setImplicitlyInline();
   Fn->setDeletedAsWritten();
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r285561 - Fix this test when we have clang-offload-bundler.exe.

2016-10-31 Thread Rafael Espindola via cfe-commits
Author: rafael
Date: Mon Oct 31 06:47:37 2016
New Revision: 285561

URL: http://llvm.org/viewvc/llvm-project?rev=285561&view=rev
Log:
Fix this test when we have clang-offload-bundler.exe.

Modified:
cfe/trunk/test/Driver/openmp-offload.c

Modified: cfe/trunk/test/Driver/openmp-offload.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/openmp-offload.c?rev=285561&r1=285560&r2=285561&view=diff
==
--- cfe/trunk/test/Driver/openmp-offload.c (original)
+++ cfe/trunk/test/Driver/openmp-offload.c Mon Oct 31 06:47:37 2016
@@ -422,13 +422,13 @@
 // Create host object and bundle.
 // CHK-BUJOBS: clang{{.*}}" "-cc1" "-triple" "powerpc64le--linux" "-emit-obj" 
{{.*}}"-fopenmp" {{.*}}"-o" "
 // CHK-BUJOBS-SAME: [[HOSTOBJ:[^\\/]+\.o]]" "-x" "ir" "{{.*}}[[HOSTBC]]"
-// CHK-BUJOBS: clang-offload-bundler" "-type=o" 
"-targets=openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu,host-powerpc64le--linux"
 "-outputs=
+// CHK-BUJOBS: clang-offload-bundler{{.*}}" "-type=o" 
"-targets=openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu,host-powerpc64le--linux"
 "-outputs=
 // CHK-BUJOBS-SAME: [[RES:[^\\/]+\.o]]" 
"-inputs={{.*}}[[T1OBJ]],{{.*}}[[T2OBJ]],{{.*}}[[HOSTOBJ]]"
 // CHK-BUJOBS-ST: clang{{.*}}" "-cc1" "-triple" "powerpc64le--linux" "-S" 
{{.*}}"-fopenmp" {{.*}}"-o" "
 // CHK-BUJOBS-ST-SAME: [[HOSTASM:[^\\/]+\.s]]" "-x" "ir" "{{.*}}[[HOSTBC]]"
 // CHK-BUJOBS-ST: clang{{.*}}" "-cc1as" "-triple" "powerpc64le--linux" 
"-filetype" "obj" {{.*}}"-o" "
 // CHK-BUJOBS-ST-SAME: [[HOSTOBJ:[^\\/]+\.o]]" "{{.*}}[[HOSTASM]]"
-// CHK-BUJOBS-ST: clang-offload-bundler" "-type=o" 
"-targets=openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu,host-powerpc64le--linux"
 "-outputs=
+// CHK-BUJOBS-ST: clang-offload-bundler{{.*}}" "-type=o" 
"-targets=openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu,host-powerpc64le--linux"
 "-outputs=
 // CHK-BUJOBS-ST-SAME: [[RES:[^\\/]+\.o]]" 
"-inputs={{.*}}[[T1OBJ]],{{.*}}[[T2OBJ]],{{.*}}[[HOSTOBJ]]"
 
 /// ###
@@ -446,14 +446,14 @@
 // RUN:   | FileCheck -check-prefix=CHK-UBJOBS2-ST %s
 
 // Unbundle and create host BC.
-// CHK-UBJOBS: clang-offload-bundler" "-type=i" 
"-targets=host-powerpc64le--linux,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu"
 "-inputs=
+// CHK-UBJOBS: clang-offload-bundler{{.*}}" "-type=i" 
"-targets=host-powerpc64le--linux,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu"
 "-inputs=
 // CHK-UBJOBS-SAME: [[INPUT:[^\\/]+\.i]]" "-outputs=
 // CHK-UBJOBS-SAME: [[HOSTPP:[^\\/]+\.i]],
 // CHK-UBJOBS-SAME: [[T1PP:[^\\/]+\.i]],
 // CHK-UBJOBS-SAME: [[T2PP:[^\\/]+\.i]]" "-unbundle"
 // CHK-UBJOBS: clang{{.*}}" "-cc1" "-triple" "powerpc64le--linux" 
"-emit-llvm-bc"  {{.*}}"-fopenmp" {{.*}}"-o" "
 // CHK-UBJOBS-SAME: [[HOSTBC:[^\\/]+\.bc]]" "-x" "cpp-output" 
"{{.*}}[[HOSTPP]]" 
"-fopenmp-targets=powerpc64le-ibm-linux-gnu,x86_64-pc-linux-gnu"
-// CHK-UBJOBS-ST: clang-offload-bundler" "-type=i" 
"-targets=host-powerpc64le--linux,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu"
 "-inputs=
+// CHK-UBJOBS-ST: clang-offload-bundler{{.*}}" "-type=i" 
"-targets=host-powerpc64le--linux,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu"
 "-inputs=
 // CHK-UBJOBS-ST-SAME: [[INPUT:[^\\/]+\.i]]" "-outputs=
 // CHK-UBJOBS-ST-SAME: [[HOSTPP:[^\\/,]+\.i]],
 // CHK-UBJOBS-ST-SAME: [[T1PP:[^\\/,]+\.i]],
@@ -504,7 +504,7 @@
 // CHK-UBJOBS-ST-SAME: [[LKS:[^\\/]+\.lk]]"
 
 // Unbundle object file.
-// CHK-UBJOBS2: clang-offload-bundler" "-type=o" 
"-targets=host-powerpc64le--linux,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu"
 "-inputs=
+// CHK-UBJOBS2: clang-offload-bundler{{.*}}" "-type=o" 
"-targets=host-powerpc64le--linux,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu"
 "-inputs=
 // CHK-UBJOBS2-SAME: [[INPUT:[^\\/]+\.o]]" "-outputs=
 // CHK-UBJOBS2-SAME: [[HOSTOBJ:[^\\/]+\.o]],
 // CHK-UBJOBS2-SAME: [[T1OBJ:[^\\/]+\.o]],
@@ -516,7 +516,7 @@
 // CHK-UBJOBS2: ld{{(\.exe)?}}" {{.*}}"-o" "
 // CHK-UBJOBS2-SAME: [[HOSTBIN:[^\\/]+\.out]]" {{.*}}"{{.*}}[[HOSTOBJ]]" 
{{.*}}"-T" "
 // CHK-UBJOBS2-SAME: [[LKS:[^\\/]+\.lk]]"
-// CHK-UBJOBS2-ST: clang-offload-bundler" "-type=o" 
"-targets=host-powerpc64le--linux,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu"
 "-inputs=
+// CHK-UBJOBS2-ST: clang-offload-bundler{{.*}}" "-type=o" 
"-targets=host-powerpc64le--linux,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu"
 "-inputs=
 // CHK-UBJOBS2-ST-SAME: [[INPUT:[^\\/]+\.o]]" "-outputs=
 // CHK-UBJOBS2-ST-SAME: [[HOSTOBJ:[^\\/,]+\.o]],
 // CHK-UBJOBS2-ST-SAME: [[T1OBJ:[^\\/,]+\.o]],
@@ -540,7 +540,7 @@
 // RUN:   | FileCheck -check-prefix=CHK-UBUJOBS-ST %s
 
 // Unbundle and create host BC.
-// CHK-UBUJOBS: clang-offload-bundler" "-type=i" 
"-targets=host-powerpc64le--linux,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-g

[PATCH] D25866: [Sema] Support implicit scalar to vector conversions

2016-10-31 Thread Simon Dardis via cfe-commits
sdardis updated the summary for this revision.
sdardis updated this revision to Diff 76385.
sdardis added a comment.

Split out a variant of tryVectorConvertAndSplat called 
tryGCCVectorConvertAndSplat. This variant checks the types more strictly than 
tryVectorConvertAndSplat and handles implicit conversion of constants which can 
be safely demoted to a smaller type.
Added more testing to vector-gcc-compat.c


https://reviews.llvm.org/D25866

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Sema/SemaExpr.cpp
  test/Sema/vector-cast.c
  test/Sema/vector-gcc-compat.c
  test/Sema/zvector.c
  test/SemaCXX/vector-no-lax.cpp

Index: test/SemaCXX/vector-no-lax.cpp
===
--- test/SemaCXX/vector-no-lax.cpp
+++ test/SemaCXX/vector-no-lax.cpp
@@ -4,6 +4,6 @@
 
 vSInt32 foo (vUInt32 a) {
   vSInt32 b = { 0, 0, 0, 0 };
-  b += a; // expected-error{{cannot convert between vector values}}
+  b += a; // expected-error{{cannot convert between vector type 'vUInt32' (vector of 4 'unsigned int' values) and vector type 'vSInt32' (vector of 4 'int' values) as implicit conversion would cause truncation}}
   return b;
 }
Index: test/Sema/zvector.c
===
--- test/Sema/zvector.c
+++ test/Sema/zvector.c
@@ -326,14 +326,14 @@
   bc = bc + sc2; // expected-error {{incompatible type}}
   bc = sc + bc2; // expected-error {{incompatible type}}
 
-  sc = sc + sc_scalar; // expected-error {{cannot convert}}
-  sc = sc + uc_scalar; // expected-error {{cannot convert}}
-  sc = sc_scalar + sc; // expected-error {{cannot convert}}
-  sc = uc_scalar + sc; // expected-error {{cannot convert}}
-  uc = uc + sc_scalar; // expected-error {{cannot convert}}
-  uc = uc + uc_scalar; // expected-error {{cannot convert}}
-  uc = sc_scalar + uc; // expected-error {{cannot convert}}
-  uc = uc_scalar + uc; // expected-error {{cannot convert}}
+  sc = sc + sc_scalar;
+  sc = sc + uc_scalar; // expected-error {{cannot convert between scalar type 'unsigned char' and vector type '__vector signed char' (vector of 16 'signed char' values) as implicit conversion would cause truncation}}
+  sc = sc_scalar + sc;
+  sc = uc_scalar + sc; // expected-error {{cannot convert between scalar type 'unsigned char' and vector type '__vector signed char' (vector of 16 'signed char' values) as implicit conversion would cause truncation}}
+  uc = uc + sc_scalar; // expected-error {{implicit conversion changes signedness: 'signed char' to '__vector unsigned char' (vector of 16 'unsigned char' values)}}
+  uc = uc + uc_scalar;
+  uc = sc_scalar + uc; // expected-error {{implicit conversion changes signedness: 'signed char' to '__vector unsigned char' (vector of 16 'unsigned char' values)}}
+  uc = uc_scalar + uc;
 
   ss = ss + ss2;
   us = us + us2;
@@ -368,10 +368,10 @@
   sc += sl2; // expected-error {{cannot convert}}
   sc += fd2; // expected-error {{cannot convert}}
 
-  sc += sc_scalar; // expected-error {{cannot convert}}
-  sc += uc_scalar; // expected-error {{cannot convert}}
-  uc += sc_scalar; // expected-error {{cannot convert}}
-  uc += uc_scalar; // expected-error {{cannot convert}}
+  sc += sc_scalar;
+  sc += uc_scalar; // expected-error {{cannot convert between scalar type 'unsigned char' and vector type '__vector signed char' (vector of 16 'signed char' values) as implicit conversion would cause truncation}}
+  uc += sc_scalar; // expected-error {{implicit conversion changes signedness: 'signed char' to '__vector unsigned char' (vector of 16 'unsigned char' values)}}
+  uc += uc_scalar;
 
   ss += ss2;
   us += us2;
Index: test/Sema/vector-gcc-compat.c
===
--- /dev/null
+++ test/Sema/vector-gcc-compat.c
@@ -0,0 +1,312 @@
+// RUN: %clang_cc1 %s -verify -fsyntax-only -Weverything
+
+typedef long long v2i64 __attribute__((vector_size(16)));
+typedef int v2i32 __attribute__((vector_size(8)));
+typedef short v2i16 __attribute__((vector_size(4)));
+typedef char v2i8 __attribute__((vector_size(2)));
+
+typedef unsigned long long v2u64 __attribute__((vector_size(16)));
+typedef unsigned int v2u32 __attribute__((vector_size(8)));
+typedef unsigned short v2u16 __attribute__((vector_size(4)));
+typedef unsigned char v2u8 __attribute__((vector_size(2)));
+
+typedef float v4f32 __attribute__((vector_size(16)));
+typedef double v4f64 __attribute__((vector_size(32)));
+
+void arithmeticTest (void);
+void logicTest (void);
+void comparisonTest (void);
+void floatTestSignedType (char a, short b, int c, long long d);
+void floatTestUnsignedType (unsigned char a, unsigned short b, unsigned int c, unsigned long long d);
+void floatTestConstant (void);
+void intTestType (char a, short b, int c, long long d);
+void intTestTypeUnsigned (unsigned char a, unsigned short b, unsigned int c, unsigned long long d);
+void uintTestType (char a, short b, int c, long long d);
+void uintTestTypeUnsig

r285563 - [x86][inline-asm] Introducing (AVX512) k0-k7 registers for inline-asm usage

2016-10-31 Thread Michael Zuckerman via cfe-commits
Author: mzuckerm
Date: Mon Oct 31 07:05:41 2016
New Revision: 285563

URL: http://llvm.org/viewvc/llvm-project?rev=285563&view=rev
Log:
 [x86][inline-asm] Introducing (AVX512) k0-k7 registers for inline-asm usage

 Commit on behalf of mharoush

 After LGTM and check all:
 This patch enables usage of k registers in inline assembly syntax.
 Adding triple

 Reviewer: 1. rnk
   2. delena

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


Added:
cfe/trunk/test/CodeGen/avx512-inline-asm-kregisters-basics.c
Modified:
cfe/trunk/lib/Basic/Targets.cpp

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=285563&r1=285562&r2=285563&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Mon Oct 31 07:05:41 2016
@@ -2397,6 +2397,7 @@ static const char* const GCCRegNames[] =
   "zmm8", "zmm9", "zmm10", "zmm11", "zmm12", "zmm13", "zmm14", "zmm15",
   "zmm16", "zmm17", "zmm18", "zmm19", "zmm20", "zmm21", "zmm22", "zmm23",
   "zmm24", "zmm25", "zmm26", "zmm27", "zmm28", "zmm29", "zmm30", "zmm31",
+  "k0", "k1", "k2", "k3", "k4", "k5", "k6", "k7",
 };
 
 const TargetInfo::AddlRegName AddlRegNames[] = {

Added: cfe/trunk/test/CodeGen/avx512-inline-asm-kregisters-basics.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512-inline-asm-kregisters-basics.c?rev=285563&view=auto
==
--- cfe/trunk/test/CodeGen/avx512-inline-asm-kregisters-basics.c (added)
+++ cfe/trunk/test/CodeGen/avx512-inline-asm-kregisters-basics.c Mon Oct 31 
07:05:41 2016
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -target-cpu skylake-avx512 
-O0  -S -o - -Wall -Werror | FileCheck %s
+// This test checks basic inline assembly recognition of k0-k7 registers for 
avx512.
+
+void test_basic_inline_asm_with_k_regs() {
+//CHECK: ## InlineAsm Start
+//CHECK: kandw %k1, %k2, %k3
+//CHECK: ## InlineAsm End
+asm("kandw %k1, %k2, %k3\t");
+//CHECK: ## InlineAsm Start
+//CHECK: kandw %k4, %k5, %k6
+//CHECK: ## InlineAsm End
+asm("kandw %k4, %k5, %k6\t");
+//CHECK: ## InlineAsm Start
+//CHECK: kandw %k7, %k0, %k1
+//CHECK: ## InlineAsm End
+asm("kandw %k7, %k0, %k1\t");
+}


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


[PATCH] D26057: [coroutines] Add CoawaitDependentExpr AST node and use it to properly build await_transform.

2016-10-31 Thread Eric Fiselier via cfe-commits
EricWF marked 10 inline comments as done.
EricWF added inline comments.



Comment at: lib/Sema/SemaCoroutine.cpp:237-244
+static UnresolvedSet<16> lookupOperatorCoawaitCall(Sema &SemaRef, Scope *S,
+   SourceLocation Loc,
+   Expr *E) {
   UnresolvedSet<16> Functions;
   SemaRef.LookupOverloadedOperatorName(OO_Coawait, S, E->getType(), QualType(),
Functions);
+  return Functions;

ABataev wrote:
> Maybe it is better to add an argument `UnresolvedSetImpl &OpCandidates`?
This seems like the best place to specify the concrete type now that everything 
else uses `UnresolvedSetImpl`.



Comment at: lib/Sema/SemaCoroutine.cpp:301
+   SourceLocation Loc, StringRef Name,
+   MutableArrayRef Args) {
+  assert(Coroutine->CoroutinePromise && "no promise for coroutine");

ABataev wrote:
> Why do you need `MutableArrayRef`, when `ArrayRef` is enough? 
> Also `buildMemberCall` must be changed
`Sema::ActOnCallExpr` requires the `MutableArrayRef`, so I don't see how this 
can be changed.



Comment at: lib/Sema/SemaCoroutine.cpp:331
+ExprResult
+Sema::BuildCoawaitDependentExpr(SourceLocation Loc, Expr *E,
+const UnresolvedSet<16> &Candidates) {

ABataev wrote:
> s/BuildCoawaitDependentExpr/buildCoawaitDependentExpr/g
Why? Every similar function uses a leading capital.


https://reviews.llvm.org/D26057



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


[PATCH] D26057: [coroutines] Add CoawaitDependentExpr AST node and use it to properly build await_transform.

2016-10-31 Thread Eric Fiselier via cfe-commits
EricWF updated this revision to Diff 76386.
EricWF added a comment.

Mark some review comments as complete.


https://reviews.llvm.org/D26057

Files:
  include/clang/AST/ExprCXX.h
  include/clang/AST/RecursiveASTVisitor.h
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Basic/StmtNodes.td
  include/clang/Sema/Sema.h
  lib/AST/Expr.cpp
  lib/AST/ExprClassification.cpp
  lib/AST/ExprConstant.cpp
  lib/AST/ItaniumMangle.cpp
  lib/AST/StmtPrinter.cpp
  lib/AST/StmtProfile.cpp
  lib/Sema/SemaCoroutine.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaExceptionSpec.cpp
  lib/Sema/TreeTransform.h
  lib/Serialization/ASTReaderStmt.cpp
  lib/Serialization/ASTWriterStmt.cpp
  lib/StaticAnalyzer/Core/ExprEngine.cpp
  test/SemaCXX/coroutines.cpp
  tools/libclang/CXCursor.cpp

Index: tools/libclang/CXCursor.cpp
===
--- tools/libclang/CXCursor.cpp
+++ tools/libclang/CXCursor.cpp
@@ -231,6 +231,7 @@
   case Stmt::TypeTraitExprClass:
   case Stmt::CoroutineBodyStmtClass:
   case Stmt::CoawaitExprClass:
+  case Stmt::CoawaitDependentExprClass:
   case Stmt::CoreturnStmtClass:
   case Stmt::CoyieldExprClass:
   case Stmt::CXXBindTemporaryExprClass:
Index: test/SemaCXX/coroutines.cpp
===
--- test/SemaCXX/coroutines.cpp
+++ test/SemaCXX/coroutines.cpp
@@ -59,14 +59,14 @@
 template 
 struct std::experimental::coroutine_traits {};
 
-int no_promise_type() {
-  co_await a; // expected-error {{this function cannot be a coroutine: 'std::experimental::coroutine_traits' has no member named 'promise_type'}}
+int no_promise_type() { // expected-error {{this function cannot be a coroutine: 'std::experimental::coroutine_traits' has no member named 'promise_type'}}
+  co_await a;
 }
 
 template <>
 struct std::experimental::coroutine_traits { typedef int promise_type; };
-double bad_promise_type(double) {
-  co_await a; // expected-error {{this function cannot be a coroutine: 'experimental::coroutine_traits::promise_type' (aka 'int') is not a class}}
+double bad_promise_type(double) { // expected-error {{this function cannot be a coroutine: 'experimental::coroutine_traits::promise_type' (aka 'int') is not a class}}
+  co_await a;
 }
 
 template <>
@@ -77,7 +77,7 @@
   co_yield 0; // expected-error {{no member named 'yield_value' in 'std::experimental::coroutine_traits::promise_type'}}
 }
 
-struct promise; // expected-note 2{{forward declaration}}
+struct promise; // expected-note {{forward declaration}}
 struct promise_void;
 struct void_tag {};
 template 
@@ -94,9 +94,7 @@
 }
 
 // FIXME: This diagnostic is terrible.
-void undefined_promise() { // expected-error {{variable has incomplete type 'promise_type'}}
-  // FIXME: This diagnostic doesn't make any sense.
-  // expected-error@-2 {{incomplete definition of type 'promise'}}
+void undefined_promise() { // expected-error {{this function cannot be a coroutine: 'experimental::coroutine_traits::promise_type' (aka 'promise') is an incomplete type}}
   co_await a;
 }
 
@@ -239,6 +237,21 @@
   };
   template void await_template(outer); // expected-note {{instantiation}}
   template void await_template_2(outer);
+
+  template  coro await_template_3(U t) {
+co_await t;
+  }
+  struct transform_awaitable {};
+  struct transformed {};
+  struct transform_promise {
+coro get_return_object();
+suspend_always initial_suspend();
+suspend_always final_suspend();
+transformed await_transform(transform_awaitable);
+  };
+  void operator co_await(transform_awaitable) = delete;
+  awaitable operator co_await(transformed);
+  template coro await_template_3(transform_awaitable);
 }
 
 struct yield_fn_tag {};
@@ -355,20 +368,68 @@
 int *current_exception();
 }
 
-struct bad_promise_8 {
+struct bad_promise_base {
+private:
+  void return_void(); // expected-note {{declared private here}}
+};
+struct bad_promise_8 : bad_promise_base {
   coro get_return_object();
   suspend_always initial_suspend();
   suspend_always final_suspend();
-  void return_void();
   void set_exception();   // expected-note {{function not viable}}
   void set_exception(int *) __attribute__((unavailable)); // expected-note {{explicitly made unavailable}}
   void set_exception(void *); // expected-note {{candidate function}}
 };
 coro calls_set_exception() {
   // expected-error@-1 {{call to unavailable member function 'set_exception'}}
+  // expected-error@-2 {{'return_void' is a private member of 'bad_promise_base'}}
   co_await a;
 }
 
+struct bad_promise_9 {
+  coro get_return_object();
+  suspend_always initial_suspend();
+  suspend_always final_suspend();
+  void await_transform(void *);// expected-note {{candidate}}
+  awaitable await_transform(int) __attribute__((unavailable)); // expected-note {{explicitly made unavailable}}
+  void return_void();
+};
+coro calls_await_transform() {
+

[PATCH] D26132: [clang-format] Skip over AnnotatedLines with >50 levels of nesting.

2016-10-31 Thread Sam McCall via cfe-commits
sammccall added a comment.

Thanks Daniel.
I don't have commit access, could you land this?


https://reviews.llvm.org/D26132



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


[PATCH] D26057: [coroutines] Add CoawaitDependentExpr AST node and use it to properly build await_transform.

2016-10-31 Thread Alexey Bataev via cfe-commits
ABataev added inline comments.



Comment at: lib/Sema/SemaCoroutine.cpp:237-244
+static UnresolvedSet<16> lookupOperatorCoawaitCall(Sema &SemaRef, Scope *S,
+   SourceLocation Loc,
+   Expr *E) {
   UnresolvedSet<16> Functions;
   SemaRef.LookupOverloadedOperatorName(OO_Coawait, S, E->getType(), QualType(),
Functions);
+  return Functions;

EricWF wrote:
> ABataev wrote:
> > Maybe it is better to add an argument `UnresolvedSetImpl &OpCandidates`?
> This seems like the best place to specify the concrete type now that 
> everything else uses `UnresolvedSetImpl`.
Does really matter that it is `UnresolvedSet<16>`, but not `UnresolvedSet<8>` 
or `UnresolvedSet<4>`? If not, you should not use `UnresolvedSet<16>` as the 
param type or return type



Comment at: lib/Sema/SemaCoroutine.cpp:301
+   SourceLocation Loc, StringRef Name,
+   MutableArrayRef Args) {
+  assert(Coroutine->CoroutinePromise && "no promise for coroutine");

EricWF wrote:
> ABataev wrote:
> > Why do you need `MutableArrayRef`, when `ArrayRef` is 
> > enough? Also `buildMemberCall` must be changed
> `Sema::ActOnCallExpr` requires the `MutableArrayRef`, so I don't see how this 
> can be changed.
Ok, then maybe it is better to use `MultiExprArg` rather than 
`MutableArrayRef` which is looking a bit confusing


https://reviews.llvm.org/D26057



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


[PATCH] D26145: DebugInfo: support for DW_TAG_atomic_type

2016-10-31 Thread Victor Leschuk via cfe-commits
vleschuk created this revision.
vleschuk added reviewers: mehdi_amini, echristo, dblaikie, aprantl.
vleschuk added a subscriber: cfe-commits.

Mark C11 _Atomic variables with DW_TAG_atomic_type tag.

This is the simplest way to achieve the goal: modifying Qualifiers results in 
much more changes and putting emission of tag into CreateQualifiedType() along 
with DW_TAG_const_type and friends seems more logic but requires way more 
changes and could break something else (my first attempt to add atomic to 
qualifiers resulted in lots of failures in OpenCL tests for some reason).


https://reviews.llvm.org/D26145

Files:
  lib/CodeGen/CGDebugInfo.cpp
  test/CodeGen/debug-info-atomic.c


Index: test/CodeGen/debug-info-atomic.c
===
--- /dev/null
+++ test/CodeGen/debug-info-atomic.c
@@ -0,0 +1,5 @@
+// RUN: %clang -g -c -std=c11 -S -emit-llvm -o - %s | FileCheck %s
+
+// CHECK: !DIDerivedType(tag: DW_TAG_const_type
+// CHECK: !DIDerivedType(tag: DW_TAG_atomic_type
+_Atomic const int i;
Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -2287,9 +2287,8 @@
 }
 
 llvm::DIType *CGDebugInfo::CreateType(const AtomicType *Ty, llvm::DIFile *U) {
-  // Ignore the atomic wrapping
-  // FIXME: What is the correct representation?
-  return getOrCreateType(Ty->getValueType(), U);
+  auto *FromTy = getOrCreateType(Ty->getValueType(), U);
+  return DBuilder.createQualifiedType(llvm::dwarf::DW_TAG_atomic_type, FromTy);
 }
 
 llvm::DIType* CGDebugInfo::CreateType(const PipeType *Ty,


Index: test/CodeGen/debug-info-atomic.c
===
--- /dev/null
+++ test/CodeGen/debug-info-atomic.c
@@ -0,0 +1,5 @@
+// RUN: %clang -g -c -std=c11 -S -emit-llvm -o - %s | FileCheck %s
+
+// CHECK: !DIDerivedType(tag: DW_TAG_const_type
+// CHECK: !DIDerivedType(tag: DW_TAG_atomic_type
+_Atomic const int i;
Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -2287,9 +2287,8 @@
 }
 
 llvm::DIType *CGDebugInfo::CreateType(const AtomicType *Ty, llvm::DIFile *U) {
-  // Ignore the atomic wrapping
-  // FIXME: What is the correct representation?
-  return getOrCreateType(Ty->getValueType(), U);
+  auto *FromTy = getOrCreateType(Ty->getValueType(), U);
+  return DBuilder.createQualifiedType(llvm::dwarf::DW_TAG_atomic_type, FromTy);
 }
 
 llvm::DIType* CGDebugInfo::CreateType(const PipeType *Ty,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D26057: [coroutines] Add CoawaitDependentExpr AST node and use it to properly build await_transform.

2016-10-31 Thread Eric Fiselier via cfe-commits
EricWF added inline comments.



Comment at: lib/Sema/SemaCoroutine.cpp:237-244
+static UnresolvedSet<16> lookupOperatorCoawaitCall(Sema &SemaRef, Scope *S,
+   SourceLocation Loc,
+   Expr *E) {
   UnresolvedSet<16> Functions;
   SemaRef.LookupOverloadedOperatorName(OO_Coawait, S, E->getType(), QualType(),
Functions);
+  return Functions;

ABataev wrote:
> EricWF wrote:
> > ABataev wrote:
> > > Maybe it is better to add an argument `UnresolvedSetImpl &OpCandidates`?
> > This seems like the best place to specify the concrete type now that 
> > everything else uses `UnresolvedSetImpl`.
> Does really matter that it is `UnresolvedSet<16>`, but not `UnresolvedSet<8>` 
> or `UnresolvedSet<4>`? If not, you should not use `UnresolvedSet<16>` as the 
> param type or return type
What matters is that `UnresolvedSetImpl` is an abstract interface and this 
function returns by value. At some point we have to choose an `N` for 
`UnresolvedSet` and this is the correct place to do it.


https://reviews.llvm.org/D26057



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


r285565 - revert r285563 fail in test CodeGen/avx512-inline-asm-kregisters-basics.c

2016-10-31 Thread Michael Zuckerman via cfe-commits
Author: mzuckerm
Date: Mon Oct 31 07:49:36 2016
New Revision: 285565

URL: http://llvm.org/viewvc/llvm-project?rev=285565&view=rev
Log:
revert r285563 fail in test CodeGen/avx512-inline-asm-kregisters-basics.c

Removed:
cfe/trunk/test/CodeGen/avx512-inline-asm-kregisters-basics.c
Modified:
cfe/trunk/lib/Basic/Targets.cpp

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=285565&r1=285564&r2=285565&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Mon Oct 31 07:49:36 2016
@@ -2397,7 +2397,6 @@ static const char* const GCCRegNames[] =
   "zmm8", "zmm9", "zmm10", "zmm11", "zmm12", "zmm13", "zmm14", "zmm15",
   "zmm16", "zmm17", "zmm18", "zmm19", "zmm20", "zmm21", "zmm22", "zmm23",
   "zmm24", "zmm25", "zmm26", "zmm27", "zmm28", "zmm29", "zmm30", "zmm31",
-  "k0", "k1", "k2", "k3", "k4", "k5", "k6", "k7",
 };
 
 const TargetInfo::AddlRegName AddlRegNames[] = {

Removed: cfe/trunk/test/CodeGen/avx512-inline-asm-kregisters-basics.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512-inline-asm-kregisters-basics.c?rev=285564&view=auto
==
--- cfe/trunk/test/CodeGen/avx512-inline-asm-kregisters-basics.c (original)
+++ cfe/trunk/test/CodeGen/avx512-inline-asm-kregisters-basics.c (removed)
@@ -1,17 +0,0 @@
-// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -target-cpu skylake-avx512 
-O0  -S -o - -Wall -Werror | FileCheck %s
-// This test checks basic inline assembly recognition of k0-k7 registers for 
avx512.
-
-void test_basic_inline_asm_with_k_regs() {
-//CHECK: ## InlineAsm Start
-//CHECK: kandw %k1, %k2, %k3
-//CHECK: ## InlineAsm End
-asm("kandw %k1, %k2, %k3\t");
-//CHECK: ## InlineAsm Start
-//CHECK: kandw %k4, %k5, %k6
-//CHECK: ## InlineAsm End
-asm("kandw %k4, %k5, %k6\t");
-//CHECK: ## InlineAsm Start
-//CHECK: kandw %k7, %k0, %k1
-//CHECK: ## InlineAsm End
-asm("kandw %k7, %k0, %k1\t");
-}


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


[PATCH] D26057: [coroutines] Add CoawaitDependentExpr AST node and use it to properly build await_transform.

2016-10-31 Thread Eric Fiselier via cfe-commits
EricWF updated this revision to Diff 76390.
EricWF marked an inline comment as done.
EricWF added a comment.

- Use `MultiExprArg` in place of `MutableArrayRef`.

Thanks for looking at this @ABataev!


https://reviews.llvm.org/D26057

Files:
  include/clang/AST/ExprCXX.h
  include/clang/AST/RecursiveASTVisitor.h
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Basic/StmtNodes.td
  include/clang/Sema/Sema.h
  lib/AST/Expr.cpp
  lib/AST/ExprClassification.cpp
  lib/AST/ExprConstant.cpp
  lib/AST/ItaniumMangle.cpp
  lib/AST/StmtPrinter.cpp
  lib/AST/StmtProfile.cpp
  lib/Sema/SemaCoroutine.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaExceptionSpec.cpp
  lib/Sema/TreeTransform.h
  lib/Serialization/ASTReaderStmt.cpp
  lib/Serialization/ASTWriterStmt.cpp
  lib/StaticAnalyzer/Core/ExprEngine.cpp
  test/SemaCXX/coroutines.cpp
  tools/libclang/CXCursor.cpp

Index: tools/libclang/CXCursor.cpp
===
--- tools/libclang/CXCursor.cpp
+++ tools/libclang/CXCursor.cpp
@@ -231,6 +231,7 @@
   case Stmt::TypeTraitExprClass:
   case Stmt::CoroutineBodyStmtClass:
   case Stmt::CoawaitExprClass:
+  case Stmt::CoawaitDependentExprClass:
   case Stmt::CoreturnStmtClass:
   case Stmt::CoyieldExprClass:
   case Stmt::CXXBindTemporaryExprClass:
Index: test/SemaCXX/coroutines.cpp
===
--- test/SemaCXX/coroutines.cpp
+++ test/SemaCXX/coroutines.cpp
@@ -59,14 +59,14 @@
 template 
 struct std::experimental::coroutine_traits {};
 
-int no_promise_type() {
-  co_await a; // expected-error {{this function cannot be a coroutine: 'std::experimental::coroutine_traits' has no member named 'promise_type'}}
+int no_promise_type() { // expected-error {{this function cannot be a coroutine: 'std::experimental::coroutine_traits' has no member named 'promise_type'}}
+  co_await a;
 }
 
 template <>
 struct std::experimental::coroutine_traits { typedef int promise_type; };
-double bad_promise_type(double) {
-  co_await a; // expected-error {{this function cannot be a coroutine: 'experimental::coroutine_traits::promise_type' (aka 'int') is not a class}}
+double bad_promise_type(double) { // expected-error {{this function cannot be a coroutine: 'experimental::coroutine_traits::promise_type' (aka 'int') is not a class}}
+  co_await a;
 }
 
 template <>
@@ -77,7 +77,7 @@
   co_yield 0; // expected-error {{no member named 'yield_value' in 'std::experimental::coroutine_traits::promise_type'}}
 }
 
-struct promise; // expected-note 2{{forward declaration}}
+struct promise; // expected-note {{forward declaration}}
 struct promise_void;
 struct void_tag {};
 template 
@@ -94,9 +94,7 @@
 }
 
 // FIXME: This diagnostic is terrible.
-void undefined_promise() { // expected-error {{variable has incomplete type 'promise_type'}}
-  // FIXME: This diagnostic doesn't make any sense.
-  // expected-error@-2 {{incomplete definition of type 'promise'}}
+void undefined_promise() { // expected-error {{this function cannot be a coroutine: 'experimental::coroutine_traits::promise_type' (aka 'promise') is an incomplete type}}
   co_await a;
 }
 
@@ -239,6 +237,21 @@
   };
   template void await_template(outer); // expected-note {{instantiation}}
   template void await_template_2(outer);
+
+  template  coro await_template_3(U t) {
+co_await t;
+  }
+  struct transform_awaitable {};
+  struct transformed {};
+  struct transform_promise {
+coro get_return_object();
+suspend_always initial_suspend();
+suspend_always final_suspend();
+transformed await_transform(transform_awaitable);
+  };
+  void operator co_await(transform_awaitable) = delete;
+  awaitable operator co_await(transformed);
+  template coro await_template_3(transform_awaitable);
 }
 
 struct yield_fn_tag {};
@@ -355,20 +368,68 @@
 int *current_exception();
 }
 
-struct bad_promise_8 {
+struct bad_promise_base {
+private:
+  void return_void(); // expected-note {{declared private here}}
+};
+struct bad_promise_8 : bad_promise_base {
   coro get_return_object();
   suspend_always initial_suspend();
   suspend_always final_suspend();
-  void return_void();
   void set_exception();   // expected-note {{function not viable}}
   void set_exception(int *) __attribute__((unavailable)); // expected-note {{explicitly made unavailable}}
   void set_exception(void *); // expected-note {{candidate function}}
 };
 coro calls_set_exception() {
   // expected-error@-1 {{call to unavailable member function 'set_exception'}}
+  // expected-error@-2 {{'return_void' is a private member of 'bad_promise_base'}}
   co_await a;
 }
 
+struct bad_promise_9 {
+  coro get_return_object();
+  suspend_always initial_suspend();
+  suspend_always final_suspend();
+  void await_transform(void *);// expected-note {{candidate}}
+  awaitable await_transform(int) __attribute__((unavailable)); // expected-note 

r285569 - clang-format: [JS] Fix missing space after 'yield'.

2016-10-31 Thread Daniel Jasper via cfe-commits
Author: djasper
Date: Mon Oct 31 08:18:25 2016
New Revision: 285569

URL: http://llvm.org/viewvc/llvm-project?rev=285569&view=rev
Log:
clang-format: [JS] Fix missing space after 'yield'.

Before:
  class X {
delete(val) {
  return null;
}
* gen() {
  yield[1, 2];
}
* gen() {
  yield{a: 1};
}
  };

After:
  class X {
delete(val) {
  return null;
}
* gen() {
  yield [1, 2];
}
* gen() {
  yield {a: 1};
}
  };

Modified:
cfe/trunk/lib/Format/TokenAnnotator.cpp
cfe/trunk/unittests/Format/FormatTestJS.cpp

Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=285569&r1=285568&r2=285569&view=diff
==
--- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp Mon Oct 31 08:18:25 2016
@@ -2133,6 +2133,9 @@ bool TokenAnnotator::spaceRequiredBefore
 if (Right.is(tok::star) &&
 Left.isOneOf(Keywords.kw_function, Keywords.kw_yield))
   return false;
+if (Right.isOneOf(tok::l_brace, tok::l_square) &&
+Left.isOneOf(Keywords.kw_function, Keywords.kw_yield))
+  return true;
 // JS methods can use some keywords as names (e.g. `delete()`).
 if (Right.is(tok::l_paren) && Line.MustBeDeclaration &&
 Left.Tok.getIdentifierInfo())

Modified: cfe/trunk/unittests/Format/FormatTestJS.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTestJS.cpp?rev=285569&r1=285568&r2=285569&view=diff
==
--- cfe/trunk/unittests/Format/FormatTestJS.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTestJS.cpp Mon Oct 31 08:18:25 2016
@@ -368,6 +368,8 @@ TEST_F(FormatTestJS, GeneratorFunctions)
"  let x = 1;\n"
"  yield x;\n"
"  yield* something();\n"
+   "  yield [1, 2];\n"
+   "  yield {a: 1};\n"
"}");
   verifyFormat("function*\n"
"f() {\n"


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


r285570 - Skip over AnnotatedLines with >50 levels of nesting; don't format them.

2016-10-31 Thread Daniel Jasper via cfe-commits
Author: djasper
Date: Mon Oct 31 08:23:00 2016
New Revision: 285570

URL: http://llvm.org/viewvc/llvm-project?rev=285570&view=rev
Log:
Skip over AnnotatedLines with >50 levels of nesting; don't format them.

Reasoning:
- ExpressionParser uses a lot of stack for these, bad in some environments.
- Our formatting algorithm is N^3 and gets really slow.
- The resulting formatting is unlikely to be any good.
- This is probably generated code we're formatting by accident.

We treat these as unparseable, and signal incomplete formatting. 50 is
an arbitrary number, I've only seen real problems from ~150 levels.

Patch by Sam McCall. Thank you.

Modified:
cfe/trunk/lib/Format/TokenAnnotator.cpp
cfe/trunk/unittests/Format/FormatTest.cpp

Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=285570&r1=285569&r2=285570&view=diff
==
--- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp Mon Oct 31 08:23:00 2016
@@ -1566,6 +1566,13 @@ void TokenAnnotator::setCommentLineLevel
   }
 }
 
+static unsigned maxNestingDepth(const AnnotatedLine &Line) {
+  unsigned Result = 0;
+  for (const auto* Tok = Line.First; Tok != nullptr; Tok = Tok->Next)
+Result = std::max(Result, Tok->NestingLevel);
+  return Result;
+}
+
 void TokenAnnotator::annotate(AnnotatedLine &Line) {
   for (SmallVectorImpl::iterator I = Line.Children.begin(),
   E = Line.Children.end();
@@ -1574,6 +1581,14 @@ void TokenAnnotator::annotate(AnnotatedL
   }
   AnnotatingParser Parser(Style, Line, Keywords);
   Line.Type = Parser.parseLine();
+
+  // With very deep nesting, ExpressionParser uses lots of stack and the
+  // formatting algorithm is very slow. We're not going to do a good job here
+  // anyway - it's probably generated code being formatted by mistake.
+  // Just skip the whole line.
+  if (maxNestingDepth(Line) > 50)
+Line.Type = LT_Invalid;
+
   if (Line.Type == LT_Invalid)
 return;
 

Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=285570&r1=285569&r2=285570&view=diff
==
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Mon Oct 31 08:23:00 2016
@@ -7179,6 +7179,30 @@ TEST_F(FormatTest, SpecialTokensAtEndOfL
   verifyFormat("operator");
 }
 
+TEST_F(FormatTest, SkipsDeeplyNestedLines) {
+  // This code would be painfully slow to format if we didn't skip it.
+  std::string Code("A(A(A(A(A(A(A(A(A(A(A(A(A(A(A(A(A(A(A(A(\n" // 20x
+   "A(A(A(A(A(A(A(A(A(A(A(A(A(A(A(A(A(A(A(A(\n"
+   "A(A(A(A(A(A(A(A(A(A(A(A(A(A(A(A(A(A(A(A(\n"
+   "A(A(A(A(A(A(A(A(A(A(A(A(A(A(A(A(A(A(A(A(\n"
+   "A(A(A(A(A(A(A(A(A(A(A(A(A(A(A(A(A(A(A(A(\n"
+   "A(1, 1)\n"
+   ", 1), 1), 1), 1), 1), 1), 1), 1), 1), 1)\n" // 10x
+   ", 1), 1), 1), 1), 1), 1), 1), 1), 1), 1)\n"
+   ", 1), 1), 1), 1), 1), 1), 1), 1), 1), 1)\n"
+   ", 1), 1), 1), 1), 1), 1), 1), 1), 1), 1)\n"
+   ", 1), 1), 1), 1), 1), 1), 1), 1), 1), 1)\n"
+   ", 1), 1), 1), 1), 1), 1), 1), 1), 1), 1)\n"
+   ", 1), 1), 1), 1), 1), 1), 1), 1), 1), 1)\n"
+   ", 1), 1), 1), 1), 1), 1), 1), 1), 1), 1)\n"
+   ", 1), 1), 1), 1), 1), 1), 1), 1), 1), 1)\n"
+   ", 1), 1), 1), 1), 1), 1), 1), 1), 1), 1);\n");
+  // Deeply nested part is untouched, rest is formatted.
+  EXPECT_EQ(std::string("int i;\n") + Code + "int j;\n",
+format(std::string("inti;\n") + Code + "intj;\n",
+   getLLVMStyle(), IC_ExpectIncomplete));
+}
+
 
//===--===//
 // Objective-C tests.
 
//===--===//


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


[PATCH] D26132: [clang-format] Skip over AnnotatedLines with >50 levels of nesting.

2016-10-31 Thread Daniel Jasper via cfe-commits
djasper closed this revision.
djasper added a comment.

Committed as r285570.


https://reviews.llvm.org/D26132



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


[PATCH] D26147: Fix archetypes.hpp under libcpp-no-extensions and std level < 14

2016-10-31 Thread Roger Ferrer Ibanez via cfe-commits
rogfer01 created this revision.
rogfer01 added reviewers: EricWF, mclow.lists, rmaprath.
rogfer01 added a subscriber: cfe-commits.

Under -fno-exceptions TEST_THROW becomes abort / __builtin_abort which returns 
void. This causes a type mismatch in the conditional operator when testing the 
library in C++98,03,11 modes.

This patch uses a comma operator to workaround this problem.


https://reviews.llvm.org/D26147

Files:
  test/support/archetypes.hpp


Index: test/support/archetypes.hpp
===
--- test/support/archetypes.hpp
+++ test/support/archetypes.hpp
@@ -147,15 +147,15 @@
 protected:
 constexpr static int check_value(int const& val) {
 #if TEST_STD_VER < 14
-  return val == -1 || val == 999 ? TEST_THROW(42) : val;
+  return val == -1 || val == 999 ? (TEST_THROW(42), 0) : val;
 #else
   assert(val != -1); assert(val != 999);
   return val;
 #endif
 }
 constexpr static int check_value(int& val, int val_cp = 0) {
 #if TEST_STD_VER < 14
-  return val_cp = val, val = -1, (val_cp == -1 || val_cp == 999 ? 
TEST_THROW(42) : val_cp);
+  return val_cp = val, val = -1, (val_cp == -1 || val_cp == 999 ? 
(TEST_THROW(42), 0) : val_cp);
 #else
   assert(val != -1); assert(val != 999);
   val_cp = val;


Index: test/support/archetypes.hpp
===
--- test/support/archetypes.hpp
+++ test/support/archetypes.hpp
@@ -147,15 +147,15 @@
 protected:
 constexpr static int check_value(int const& val) {
 #if TEST_STD_VER < 14
-  return val == -1 || val == 999 ? TEST_THROW(42) : val;
+  return val == -1 || val == 999 ? (TEST_THROW(42), 0) : val;
 #else
   assert(val != -1); assert(val != 999);
   return val;
 #endif
 }
 constexpr static int check_value(int& val, int val_cp = 0) {
 #if TEST_STD_VER < 14
-  return val_cp = val, val = -1, (val_cp == -1 || val_cp == 999 ? TEST_THROW(42) : val_cp);
+  return val_cp = val, val = -1, (val_cp == -1 || val_cp == 999 ? (TEST_THROW(42), 0) : val_cp);
 #else
   assert(val != -1); assert(val != 999);
   val_cp = val;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D26148: Add missing cases to FunctionDecl::isThisDeclarationADefinition

2016-10-31 Thread Serge Pavlov via cfe-commits
sepavloff created this revision.
sepavloff added a subscriber: cfe-commits.

This change adds to the method isThisDeclarationADefinition additional
conditions under which a function declaration becomes a definition.
These includes the case of a declaration that does not have a function
body because the latter is not instantiated yet.


https://reviews.llvm.org/D26148

Files:
  include/clang/AST/Decl.h
  test/SemaCXX/cxx0x-cursory-default-delete.cpp


Index: test/SemaCXX/cxx0x-cursory-default-delete.cpp
===
--- test/SemaCXX/cxx0x-cursory-default-delete.cpp
+++ test/SemaCXX/cxx0x-cursory-default-delete.cpp
@@ -136,13 +136,13 @@
 };
 
 struct DefaultDelete {
-  DefaultDelete() = default; // expected-note {{previous declaration is here}}
+  DefaultDelete() = default; // expected-note {{previous definition is here}}
   DefaultDelete() = delete; // expected-error {{constructor cannot be 
redeclared}}
 
-  ~DefaultDelete() = default; // expected-note {{previous declaration is here}}
+  ~DefaultDelete() = default; // expected-note {{previous definition is here}}
   ~DefaultDelete() = delete; // expected-error {{destructor cannot be 
redeclared}}
 
-  DefaultDelete &operator=(const DefaultDelete &) = default; // expected-note 
{{previous declaration is here}}
+  DefaultDelete &operator=(const DefaultDelete &) = default; // expected-note 
{{previous definition is here}}
   DefaultDelete &operator=(const DefaultDelete &) = delete; // expected-error 
{{class member cannot be redeclared}}
 };
 
Index: include/clang/AST/Decl.h
===
--- include/clang/AST/Decl.h
+++ include/clang/AST/Decl.h
@@ -1831,14 +1831,26 @@
 return getBody(Definition);
   }
 
-  /// isThisDeclarationADefinition - Returns whether this specific
-  /// declaration of the function is also a definition. This does not
-  /// determine whether the function has been defined (e.g., in a
-  /// previous definition); for that information, use isDefined. Note
-  /// that this returns false for a defaulted function unless that function
-  /// has been implicitly defined (possibly as deleted).
+  /// Returns whether this specific declaration of the function is also
+  /// a definition.
+  ///
+  /// The method checks for definiteness of the declaration in the sense, used
+  /// in redefinition checks. A defined function usually cannot have more than
+  /// one definition. At the same time it may have its body absent, for 
instance,
+  /// because it does not exist at all as in deleted functions, or is not
+  /// instantiated yet as in templated entities. Corresponding declarations are
+  /// also reported as definitions.
+  ///
+  /// This does not determine whether the function has been defined (e.g., in a
+  /// previous definition); for that information, use isDefined.
+  ///
   bool isThisDeclarationADefinition() const {
-return IsDeleted || Body || IsLateTemplateParsed;
+if (IsDeleted || IsDefaulted || Body || IsLateTemplateParsed ||
+hasDefiningAttr())
+  return true;
+if (FunctionDecl *Original = getInstantiatedFromMemberFunction())
+  return Original->isThisDeclarationADefinition();
+return false;
   }
 
   /// doesThisDeclarationHaveABody - Returns whether this specific


Index: test/SemaCXX/cxx0x-cursory-default-delete.cpp
===
--- test/SemaCXX/cxx0x-cursory-default-delete.cpp
+++ test/SemaCXX/cxx0x-cursory-default-delete.cpp
@@ -136,13 +136,13 @@
 };
 
 struct DefaultDelete {
-  DefaultDelete() = default; // expected-note {{previous declaration is here}}
+  DefaultDelete() = default; // expected-note {{previous definition is here}}
   DefaultDelete() = delete; // expected-error {{constructor cannot be redeclared}}
 
-  ~DefaultDelete() = default; // expected-note {{previous declaration is here}}
+  ~DefaultDelete() = default; // expected-note {{previous definition is here}}
   ~DefaultDelete() = delete; // expected-error {{destructor cannot be redeclared}}
 
-  DefaultDelete &operator=(const DefaultDelete &) = default; // expected-note {{previous declaration is here}}
+  DefaultDelete &operator=(const DefaultDelete &) = default; // expected-note {{previous definition is here}}
   DefaultDelete &operator=(const DefaultDelete &) = delete; // expected-error {{class member cannot be redeclared}}
 };
 
Index: include/clang/AST/Decl.h
===
--- include/clang/AST/Decl.h
+++ include/clang/AST/Decl.h
@@ -1831,14 +1831,26 @@
 return getBody(Definition);
   }
 
-  /// isThisDeclarationADefinition - Returns whether this specific
-  /// declaration of the function is also a definition. This does not
-  /// determine whether the function has been defined (e.g., in a
-  /// previous definition); for that information, use isDefined. Note
-  /// that this returns false for a defaul

[PATCH] D24085: arm: Fix ttype encoding assertion failure.

2016-10-31 Thread Logan Chien via cfe-commits
logan updated this revision to Diff 76394.
logan added a comment.

Refine assertions to address the comments from mclow.lists.


https://reviews.llvm.org/D24085

Files:
  src/cxa_personality.cpp
  test/lit.cfg
  test/lit.site.cfg.in
  test/native/arm-linux-eabi/lit.local.cfg
  test/native/arm-linux-eabi/ttype-encoding-00.pass.sh.s
  test/native/arm-linux-eabi/ttype-encoding-90.pass.sh.s

Index: test/native/arm-linux-eabi/ttype-encoding-90.pass.sh.s
===
--- /dev/null
+++ test/native/arm-linux-eabi/ttype-encoding-90.pass.sh.s
@@ -0,0 +1,96 @@
+@ RUN: %cxx %flags %link_flags %s -o %t.exe
+@ RUN: %exec %t.exe
+
+@ PURPOSE: Check that 0x90 is a valid value for ttype encoding.
+
+@ NOTE:
+@
+@ This file is generated from the following C++ source code and then change the
+@ `TType Encoding` to 0x90.
+@
+@ ```
+@ int main() {
+@   try {
+@ throw 5;
+@   } catch (int i) {
+@ if (i != 5)
+@   abort();
+@ return 0;
+@   }
+@ }
+@ ```
+
+	.syntax unified
+
+	.text
+	.globl	main
+	.p2align	2
+	.type	main,%function
+main:   @ @main
+.Lfunc_begin0:
+	.fnstart
+@ BB#0: @ %entry
+	.save	{r11, lr}
+	push	{r11, lr}
+	.setfp	r11, sp
+	mov	r11, sp
+	mov	r0, #4
+	bl	__cxa_allocate_exception
+	mov	r1, #5
+	str	r1, [r0]
+.Ltmp0:
+	ldr	r1, .LCPI0_0
+	mov	r2, #0
+	bl	__cxa_throw
+.Ltmp1:
+
+@ BB#2: @ %lpad
+.Ltmp2:
+	bl	__cxa_begin_catch
+	ldr	r0, [r0]
+	cmp	r0, #5
+	bne	.LBB0_4
+@ BB#3: @ %if.end
+	bl	__cxa_end_catch
+	mov	r0, #0
+	pop	{r11, lr}
+	bx	lr
+.LBB0_4:@ %if.then
+	bl	abort
+	.p2align	2
+@ BB#5:
+.LCPI0_0:
+	.long	_ZTIi
+.Lfunc_end0:
+
+	.size	main, .Lfunc_end0-main
+	.globl	__gxx_personality_v0
+	.personality __gxx_personality_v0
+	.handlerdata
+	.p2align	2
+GCC_except_table0:
+.Lexception0:
+	.byte	255 @ @LPStart Encoding = omit
+	.byte	0x90@ @TType Encoding = indirect | pcrel
+	.asciz	"\257\200"  @ @TType base offset
+	.byte	3   @ Call site Encoding = udata4
+	.byte	39  @ Call site table length
+	.long	.Lfunc_begin0-.Lfunc_begin0 @ >> Call Site 1 <<
+	.long	.Ltmp0-.Lfunc_begin0@   Call between .Lfunc_begin0 and .Ltmp0
+	.long	0   @ has no landing pad
+	.byte	0   @   On action: cleanup
+	.long	.Ltmp0-.Lfunc_begin0@ >> Call Site 2 <<
+	.long	.Ltmp1-.Ltmp0   @   Call between .Ltmp0 and .Ltmp1
+	.long	.Ltmp2-.Lfunc_begin0@ jumps to .Ltmp2
+	.byte	1   @   On action: 1
+	.long	.Ltmp1-.Lfunc_begin0@ >> Call Site 3 <<
+	.long	.Lfunc_end0-.Ltmp1  @   Call between .Ltmp1 and .Lfunc_end0
+	.long	0   @ has no landing pad
+	.byte	0   @   On action: cleanup
+	.byte	1   @ >> Action Record 1 <<
+@   Catch TypeInfo 1
+	.byte	0   @   No further actions
+@ >> Catch TypeInfos <<
+	.long	_ZTIi(target2)  @ TypeInfo 1
+	.p2align	2
+	.fnend
Index: test/native/arm-linux-eabi/ttype-encoding-00.pass.sh.s
===
--- /dev/null
+++ test/native/arm-linux-eabi/ttype-encoding-00.pass.sh.s
@@ -0,0 +1,97 @@
+@ RUN: %cxx %flags %link_flags %s -o %t.exe
+@ RUN: %exec %t.exe
+
+@ PURPOSE: Check that 0x00 is a valid value for ttype encoding.  LLVM and
+@ GCC 4.6 are generating 0x00 as ttype encoding.  libc++abi should provide
+@ legacy support.
+
+@ NOTE:
+@
+@ This file is generated from the following C++ source code:
+@
+@ ```
+@ int main() {
+@   try {
+@ throw 5;
+@   } catch (int i) {
+@ if (i != 5)
+@   abort();
+@ return 0;
+@   }
+@ }
+@ ```
+
+	.syntax unified
+
+	.text
+	.globl	main
+	.p2align	2
+	.type	main,%function
+main:   @ @main
+.Lfunc_begin0:
+	.fnstart
+@ BB#0: @ %entry
+	.save	{r11, lr}
+	push	{r11, lr}
+	.setfp	r11, sp
+	mov	r11, sp
+	mov	r0, #4
+	bl	__cxa_allocate_exception
+	mov	r1, #5
+	str	r1, [r0]
+.Ltmp0:
+	ldr	r1, .LCPI0_0
+	mov	r2, #0
+	bl	__cxa_throw
+.Ltmp1:
+
+@ BB#2: @ %lpad
+.Ltmp2:
+	bl	__cxa_begin_catch
+	ldr	r0, [r0]
+	cmp	r0, #5
+	bne	.LBB0_4
+@ BB#3: @ %if.end
+	bl	__cxa_end_catch
+	mov	r0, #0
+	pop	{r11, lr}
+	bx	lr
+.LBB0_4:@ %if.then
+	bl	abort
+	.p2align	2
+@ BB#5:
+.LCPI0_0:
+	.long	_ZTIi
+.Lfunc_end0:
+
+	.size	main, .Lfunc_end0-main
+	.globl	__gxx_personality_v0
+	.personality __gxx_personality_v0
+	.handlerdata
+	.p2align	2
+GCC_except_table0:
+.Lexception0:
+	.byte	255 @ @LPStart Encoding = omit
+	.byte	0   @ @TType Encoding = absptr
+	.asciz	"\257\

[PATCH] D24082: [CMake] Fix libc++abi arm build w/o libunwind.

2016-10-31 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

Is `ON` the right default for ARM? If so please apply the inline comment to fix 
the default settings.. Otherwise this LGTM.




Comment at: CMakeLists.txt:117
 option(LIBCXXABI_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
 option(LIBCXXABI_USE_LLVM_UNWINDER "Build and use the LLVM unwinder." OFF)
 option(LIBCXXABI_USE_COMPILER_RT "Use compiler-rt instead of libgcc" OFF)

```
cmake_dependent_option(LIBCXXABI_USE_LLVM_UNWINDER "Build and use the LLVM 
unwinder" OFF
   "LLVM_NATIVE_ARCH MATCHES ARM" ON)
```

And don't forget to add the include for cmake_dependent_option somewhere above!


https://reviews.llvm.org/D24082



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


[PATCH] D26057: [coroutines] Add CoawaitDependentExpr AST node and use it to properly build await_transform.

2016-10-31 Thread Eric Fiselier via cfe-commits
EricWF planned changes to this revision.
EricWF added a comment.

I think there's a better way to do this. The implicitly created initial and 
final suspend  also require the overload set for operator co_await, so I think 
a better approach would be to store the lookup results inside `FunctionDecl`.


https://reviews.llvm.org/D26057



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


[PATCH] D24082: [CMake] Fix libc++abi arm build w/o libunwind.

2016-10-31 Thread Eric Fiselier via cfe-commits
EricWF added inline comments.



Comment at: CMakeLists.txt:117
 option(LIBCXXABI_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
 option(LIBCXXABI_USE_LLVM_UNWINDER "Build and use the LLVM unwinder." OFF)
 option(LIBCXXABI_USE_COMPILER_RT "Use compiler-rt instead of libgcc" OFF)

EricWF wrote:
> ```
> cmake_dependent_option(LIBCXXABI_USE_LLVM_UNWINDER "Build and use the LLVM 
> unwinder" OFF
>"LLVM_NATIVE_ARCH MATCHES ARM" ON)
> ```
> 
> And don't forget to add the include for cmake_dependent_option somewhere 
> above!
The above code isn't correct as-is. You'll have to escape the strings for 
MATCHES.


https://reviews.llvm.org/D24082



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


[PATCH] D24082: [CMake] Fix libc++abi arm build w/o libunwind.

2016-10-31 Thread Logan Chien via cfe-commits
logan added a comment.

Hi @EricWF and @mclow.lists:

Do you have any comments?


https://reviews.llvm.org/D24082



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


[PATCH] D26147: Fix archetypes.hpp under libcpp-no-extensions and std level < 14

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

Thanks!


https://reviews.llvm.org/D26147



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


[libcxxabi] r285571 - Spell libcxxabi-no-threads correctly

2016-10-31 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Mon Oct 31 09:14:04 2016
New Revision: 285571

URL: http://llvm.org/viewvc/llvm-project?rev=285571&view=rev
Log:
Spell libcxxabi-no-threads correctly

Modified:
libcxxabi/trunk/test/cxa_thread_atexit_test.pass.cpp

Modified: libcxxabi/trunk/test/cxa_thread_atexit_test.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/cxa_thread_atexit_test.pass.cpp?rev=285571&r1=285570&r2=285571&view=diff
==
--- libcxxabi/trunk/test/cxa_thread_atexit_test.pass.cpp (original)
+++ libcxxabi/trunk/test/cxa_thread_atexit_test.pass.cpp Mon Oct 31 09:14:04 
2016
@@ -7,7 +7,7 @@
 //
 
//===--===//
 
-// UNSUPPORTED: libcppabi-no-threads
+// UNSUPPORTED: libcxxabi-no-threads
 // REQUIRES: linux
 
 #include 


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


[libcxx] r285572 - Fix archetypes.hpp under libcpp-no-extensions and std level < 14

2016-10-31 Thread Roger Ferrer Ibanez via cfe-commits
Author: rogfer01
Date: Mon Oct 31 09:14:13 2016
New Revision: 285572

URL: http://llvm.org/viewvc/llvm-project?rev=285572&view=rev
Log:
Fix archetypes.hpp under libcpp-no-extensions and std level < 14

Under -fno-exceptions TEST_THROW becomes abort / __builtin_abort which returns
void. This causes a type mismatch in the conditional operator when testing the
library in C++98,03,11 modes.

Use a comma operator to workaround this problem.

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


Modified:
libcxx/trunk/test/support/archetypes.hpp

Modified: libcxx/trunk/test/support/archetypes.hpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/archetypes.hpp?rev=285572&r1=285571&r2=285572&view=diff
==
--- libcxx/trunk/test/support/archetypes.hpp (original)
+++ libcxx/trunk/test/support/archetypes.hpp Mon Oct 31 09:14:13 2016
@@ -147,7 +147,7 @@ struct ValueBase {
 protected:
 constexpr static int check_value(int const& val) {
 #if TEST_STD_VER < 14
-  return val == -1 || val == 999 ? TEST_THROW(42) : val;
+  return val == -1 || val == 999 ? (TEST_THROW(42), 0) : val;
 #else
   assert(val != -1); assert(val != 999);
   return val;
@@ -155,7 +155,7 @@ protected:
 }
 constexpr static int check_value(int& val, int val_cp = 0) {
 #if TEST_STD_VER < 14
-  return val_cp = val, val = -1, (val_cp == -1 || val_cp == 999 ? 
TEST_THROW(42) : val_cp);
+  return val_cp = val, val = -1, (val_cp == -1 || val_cp == 999 ? 
(TEST_THROW(42), 0) : val_cp);
 #else
   assert(val != -1); assert(val != 999);
   val_cp = val;


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


[PATCH] D26147: Fix archetypes.hpp under libcpp-no-extensions and std level < 14

2016-10-31 Thread Roger Ferrer Ibanez via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL285572: Fix archetypes.hpp under libcpp-no-extensions and 
std level < 14 (authored by rogfer01).

Changed prior to commit:
  https://reviews.llvm.org/D26147?vs=76393&id=76399#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D26147

Files:
  libcxx/trunk/test/support/archetypes.hpp


Index: libcxx/trunk/test/support/archetypes.hpp
===
--- libcxx/trunk/test/support/archetypes.hpp
+++ libcxx/trunk/test/support/archetypes.hpp
@@ -147,15 +147,15 @@
 protected:
 constexpr static int check_value(int const& val) {
 #if TEST_STD_VER < 14
-  return val == -1 || val == 999 ? TEST_THROW(42) : val;
+  return val == -1 || val == 999 ? (TEST_THROW(42), 0) : val;
 #else
   assert(val != -1); assert(val != 999);
   return val;
 #endif
 }
 constexpr static int check_value(int& val, int val_cp = 0) {
 #if TEST_STD_VER < 14
-  return val_cp = val, val = -1, (val_cp == -1 || val_cp == 999 ? 
TEST_THROW(42) : val_cp);
+  return val_cp = val, val = -1, (val_cp == -1 || val_cp == 999 ? 
(TEST_THROW(42), 0) : val_cp);
 #else
   assert(val != -1); assert(val != 999);
   val_cp = val;


Index: libcxx/trunk/test/support/archetypes.hpp
===
--- libcxx/trunk/test/support/archetypes.hpp
+++ libcxx/trunk/test/support/archetypes.hpp
@@ -147,15 +147,15 @@
 protected:
 constexpr static int check_value(int const& val) {
 #if TEST_STD_VER < 14
-  return val == -1 || val == 999 ? TEST_THROW(42) : val;
+  return val == -1 || val == 999 ? (TEST_THROW(42), 0) : val;
 #else
   assert(val != -1); assert(val != 999);
   return val;
 #endif
 }
 constexpr static int check_value(int& val, int val_cp = 0) {
 #if TEST_STD_VER < 14
-  return val_cp = val, val = -1, (val_cp == -1 || val_cp == 999 ? TEST_THROW(42) : val_cp);
+  return val_cp = val, val = -1, (val_cp == -1 || val_cp == 999 ? (TEST_THROW(42), 0) : val_cp);
 #else
   assert(val != -1); assert(val != 999);
   val_cp = val;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r285573 - second attempt at r285565.

2016-10-31 Thread Michael Zuckerman via cfe-commits
Author: mzuckerm
Date: Mon Oct 31 09:16:57 2016
New Revision: 285573

URL: http://llvm.org/viewvc/llvm-project?rev=285573&view=rev
Log:
second attempt at r285565.

Added:
cfe/trunk/test/CodeGen/avx512-inline-asm-kregisters-basics.c
Modified:
cfe/trunk/lib/Basic/Targets.cpp

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=285573&r1=285572&r2=285573&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Mon Oct 31 09:16:57 2016
@@ -2397,6 +2397,7 @@ static const char* const GCCRegNames[] =
   "zmm8", "zmm9", "zmm10", "zmm11", "zmm12", "zmm13", "zmm14", "zmm15",
   "zmm16", "zmm17", "zmm18", "zmm19", "zmm20", "zmm21", "zmm22", "zmm23",
   "zmm24", "zmm25", "zmm26", "zmm27", "zmm28", "zmm29", "zmm30", "zmm31",
+  "k0", "k1", "k2", "k3", "k4", "k5", "k6", "k7",
 };
 
 const TargetInfo::AddlRegName AddlRegNames[] = {

Added: cfe/trunk/test/CodeGen/avx512-inline-asm-kregisters-basics.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512-inline-asm-kregisters-basics.c?rev=285573&view=auto
==
--- cfe/trunk/test/CodeGen/avx512-inline-asm-kregisters-basics.c (added)
+++ cfe/trunk/test/CodeGen/avx512-inline-asm-kregisters-basics.c Mon Oct 31 
09:16:57 2016
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 %s -O0 -triple=x86_64-apple-darwin -target-cpu 
skylake-avx512 -emit-llvm -o - -Wall -Werror | FileCheck %s
+// This test checks basic inline assembly recognition of k0-k7 registers for 
avx512.
+
+void test_basic_inline_asm_with_k_regs() {
+//CHECK: kandw %k1, %k2, %k3
+asm("kandw %k1, %k2, %k3\t");
+//CHECK: kandw %k4, %k5, %k6
+asm("kandw %k4, %k5, %k6\t");
+//CHECK: kandw %k7, %k0, %k1
+asm("kandw %k7, %k0, %k1\t");
+}
\ No newline at end of file


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


[PATCH] D26041: [clang-tidy] Extend misc-use-after-move to support unique_ptr and shared_ptr.

2016-10-31 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments.



Comment at: clang-tidy/misc/UseAfterMoveCheck.cpp:467
+StringRef getName(const NamedDecl *ND) {
+  if (!ND->getIdentifier())
+return StringRef();

This logic could be improved as:
```
if (const auto *ID = ND->getIdentifier())
  return ID->getName();
return "";
```
However, I'm not certain that this function is needed at all -- it's pretty 
simple and is only used from `isStandardSmartPointer()`.



Comment at: clang-tidy/misc/UseAfterMoveCheck.cpp:482
+  StringRef Name = getName(RecordDecl);
+  if (Name != "unique_ptr" && Name != "shared_ptr")
+return false;

Shouldn't this improvement also include `weak_ptr`?



Comment at: clang-tidy/misc/UseAfterMoveCheck.cpp:542
+  auto StandardSmartPointerTypeMatcher = hasType(
+  cxxRecordDecl(hasAnyName("::std::unique_ptr", "::std::shared_ptr")));
+

And `::std::weak_ptr`?


Repository:
  rL LLVM

https://reviews.llvm.org/D26041



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


[PATCH] D26138: [clang-tidy] Add modernize-use-delete check

2016-10-31 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added a comment.

Please mention this check in docs/ReleaseNotes.rst (in alphabetical order).


https://reviews.llvm.org/D26138



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


[PATCH] D26041: [clang-tidy] Extend misc-use-after-move to support unique_ptr and shared_ptr.

2016-10-31 Thread Alexander Kornienko via cfe-commits
alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.

LG modulo comments.




Comment at: clang-tidy/misc/UseAfterMoveCheck.cpp:498
+auto addDeclRefs = [this, Block,
+DeclRefs](const SmallVectorImpl &Matches) {
+  for (const auto &Match : Matches) {

Use `ArrayRef` instead of `const SmallVectorImpl<> &`.


Repository:
  rL LLVM

https://reviews.llvm.org/D26041



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


[PATCH] D25316: [clang-tidy] Enhance modernize-use-auto to casts

2016-10-31 Thread Alexander Kornienko via cfe-commits
alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.

Sorry for the delay. Feel free to ping earlier.

One more comment, otherwise looks good.




Comment at: docs/clang-tidy/checks/modernize-use-auto.rst:163
+The check handles ``static_cast``, ``dynamic_cast``, ``const_cast``,
+``reinterpret_cast``, functional casts and c style casts.
+

nit: "C-style casts"


https://reviews.llvm.org/D25316



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


r285578 - [SystemZ] Add -march=archX aliases

2016-10-31 Thread Ulrich Weigand via cfe-commits
Author: uweigand
Date: Mon Oct 31 09:38:05 2016
New Revision: 285578

URL: http://llvm.org/viewvc/llvm-project?rev=285578&view=rev
Log:
[SystemZ] Add -march=archX aliases

For compatibility with other compilers on the platform, allow specifying
levels of the z/Architecture instead of model names with -march.  In
particular, the following aliases are now supported:

  -march=arch8   equals  -march=z10
  -march=arch9   equals  -march=z196
  -march=arch10  equals  -march=zEC12
  -march=arch11  equals  -march=z13

This parallels the equivalent (and prerequisite) LLVM change in r285577.


Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/test/CodeGen/systemz-abi-vector.c
cfe/trunk/test/CodeGen/systemz-abi.c
cfe/trunk/test/CodeGen/target-data.c
cfe/trunk/test/Driver/systemz-march.c
cfe/trunk/test/Preprocessor/predefined-arch-macros.c

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=285578&r1=285577&r2=285578&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Mon Oct 31 09:38:05 2016
@@ -6941,9 +6941,13 @@ public:
 CPU = Name;
 bool CPUKnown = llvm::StringSwitch(Name)
   .Case("z10", true)
+  .Case("arch8", true)
   .Case("z196", true)
+  .Case("arch9", true)
   .Case("zEC12", true)
+  .Case("arch10", true)
   .Case("z13", true)
+  .Case("arch11", true)
   .Default(false);
 
 return CPUKnown;
@@ -6952,9 +6956,9 @@ public:
   initFeatureMap(llvm::StringMap &Features, DiagnosticsEngine &Diags,
  StringRef CPU,
  const std::vector &FeaturesVec) const override {
-if (CPU == "zEC12")
+if (CPU == "zEC12" || CPU == "arch10")
   Features["transactional-execution"] = true;
-if (CPU == "z13") {
+if (CPU == "z13" || CPU == "arch11") {
   Features["transactional-execution"] = true;
   Features["vector"] = true;
 }

Modified: cfe/trunk/test/CodeGen/systemz-abi-vector.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/systemz-abi-vector.c?rev=285578&r1=285577&r2=285578&view=diff
==
--- cfe/trunk/test/CodeGen/systemz-abi-vector.c (original)
+++ cfe/trunk/test/CodeGen/systemz-abi-vector.c Mon Oct 31 09:38:05 2016
@@ -4,6 +4,8 @@
 // RUN:   -emit-llvm -o - %s | FileCheck --check-prefix=CHECK-VECTOR %s
 // RUN: %clang_cc1 -triple s390x-linux-gnu -target-cpu z13 \
 // RUN:   -emit-llvm -o - %s | FileCheck --check-prefix=CHECK-VECTOR %s
+// RUN: %clang_cc1 -triple s390x-linux-gnu -target-cpu arch11 \
+// RUN:   -emit-llvm -o - %s | FileCheck --check-prefix=CHECK-VECTOR %s
 
 // Vector types
 

Modified: cfe/trunk/test/CodeGen/systemz-abi.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/systemz-abi.c?rev=285578&r1=285577&r2=285578&view=diff
==
--- cfe/trunk/test/CodeGen/systemz-abi.c (original)
+++ cfe/trunk/test/CodeGen/systemz-abi.c Mon Oct 31 09:38:05 2016
@@ -4,6 +4,8 @@
 // RUN:   -emit-llvm -o - %s | FileCheck %s
 // RUN: %clang_cc1 -triple s390x-linux-gnu -target-cpu z13 \
 // RUN:   -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple s390x-linux-gnu -target-cpu arch11 \
+// RUN:   -emit-llvm -o - %s | FileCheck %s
 
 // Scalar types
 

Modified: cfe/trunk/test/CodeGen/target-data.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/target-data.c?rev=285578&r1=285577&r2=285578&view=diff
==
--- cfe/trunk/test/CodeGen/target-data.c (original)
+++ cfe/trunk/test/CodeGen/target-data.c Mon Oct 31 09:38:05 2016
@@ -169,6 +169,8 @@
 
 // RUN: %clang_cc1 -triple s390x-unknown -target-cpu z13 -o - -emit-llvm %s | \
 // RUN: FileCheck %s -check-prefix=SYSTEMZ-VECTOR
+// RUN: %clang_cc1 -triple s390x-unknown -target-cpu arch11 -o - -emit-llvm %s 
| \
+// RUN: FileCheck %s -check-prefix=SYSTEMZ-VECTOR
 // SYSTEMZ-VECTOR: target datalayout = 
"E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64"
 
 // RUN: %clang_cc1 -triple msp430-unknown -o - -emit-llvm %s | \

Modified: cfe/trunk/test/Driver/systemz-march.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/systemz-march.c?rev=285578&r1=285577&r2=285578&view=diff
==
--- cfe/trunk/test/Driver/systemz-march.c (original)
+++ cfe/trunk/test/Driver/systemz-march.c Mon Oct 31 09:38:05 2016
@@ -2,12 +2,22 @@
 
 // RUN: not %clang -target s390x -S -emit-llvm -march=z9 %s -o - 2>&1 | 
FileCheck --check-prefix=CHECK-Z9 %s
 // RUN: %clang -target s390x -### -S -emit-llvm -march=z10 %s 2>&1 | FileCheck 
--check-prefix=CHECK-Z10 %s
+// RUN: %clang -target s390x -### -S -emit-llvm -march=arch8 %s 2>&1

[PATCH] D25316: [clang-tidy] Enhance modernize-use-auto to casts

2016-10-31 Thread Malcolm Parsons via cfe-commits
malcolm.parsons updated this revision to Diff 76404.
malcolm.parsons added a comment.

Change doc to say "C-style casts".


https://reviews.llvm.org/D25316

Files:
  clang-tidy/modernize/UseAutoCheck.cpp
  clang-tidy/modernize/UseAutoCheck.h
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/modernize-use-auto.rst
  test/clang-tidy/modernize-use-auto-cast-remove-stars.cpp
  test/clang-tidy/modernize-use-auto-cast.cpp
  test/clang-tidy/modernize-use-auto-new.cpp

Index: test/clang-tidy/modernize-use-auto-new.cpp
===
--- test/clang-tidy/modernize-use-auto-new.cpp
+++ test/clang-tidy/modernize-use-auto-new.cpp
@@ -15,6 +15,10 @@
   // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: use auto when initializing with new
   // CHECK-FIXES: static auto *a_static = new MyType();
 
+  long long *ll = new long long();
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with new
+  // CHECK-FIXES: auto *ll = new long long();
+
   MyType *derived = new MyDerivedType();
 
   void *vd = new MyType();
Index: test/clang-tidy/modernize-use-auto-cast.cpp
===
--- /dev/null
+++ test/clang-tidy/modernize-use-auto-cast.cpp
@@ -0,0 +1,120 @@
+// RUN: %check_clang_tidy %s modernize-use-auto %t -- -- \
+// RUN:   -std=c++11 -I %S/Inputs/modernize-use-auto
+
+struct A {
+  virtual ~A() {}
+};
+
+struct B : public A {};
+
+struct C {};
+
+void f_static_cast() {
+  long l = 1;
+  int i1 = static_cast(l);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplicating the type name
+  // CHECK-FIXES: auto i1 = static_cast(l);
+
+  const int i2 = static_cast(l);
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: use auto when initializing with a cast to avoid duplicating the type name
+  // CHECK-FIXES: const auto i2 = static_cast(l);
+
+  long long ll = static_cast(l);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplicating the type name
+  // CHECK-FIXES: auto ll = static_cast(l);
+  unsigned long long ull = static_cast(l);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplicating the type name
+  // CHECK-FIXES: auto ull = static_cast(l);
+  unsigned int ui = static_cast(l);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplicating the type name
+  // CHECK-FIXES: auto ui = static_cast(l);
+  long double ld = static_cast(l);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplicating the type name
+  // CHECK-FIXES: auto ld = static_cast(l);
+
+  A *a = new B();
+  B *b1 = static_cast(a);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplicating the type name
+  // CHECK-FIXES: auto *b1 = static_cast(a);
+
+  B *const b2 = static_cast(a);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplicating the type name
+  // CHECK-FIXES: auto *const b2 = static_cast(a);
+
+  const B *b3 = static_cast(a);
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: use auto when initializing with a cast to avoid duplicating the type name
+  // CHECK-FIXES: const auto *b3 = static_cast(a);
+
+  B &b4 = static_cast(*a);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplicating the type name
+  // CHECK-FIXES: auto &b4 = static_cast(*a);
+
+  const B &b5 = static_cast(*a);
+  // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: use auto when initializing with a cast to avoid duplicating the type name
+  // CHECK-FIXES: const auto &b5 = static_cast(*a);
+
+  B &b6 = static_cast(*a), &b7 = static_cast(*a);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplicating the type name
+  // CHECK-FIXES: auto &b6 = static_cast(*a), &b7 = static_cast(*a);
+
+  // Don't warn when non-cast involved
+  long double cast = static_cast(l), noncast = 5;
+
+  // Don't warn when auto is already being used.
+  auto i3 = static_cast(l);
+  auto *b8 = static_cast(a);
+  auto &b9 = static_cast(*a);
+}
+
+void f_dynamic_cast() {
+  A *a = new B();
+  B *b1 = dynamic_cast(a);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplicating the type name
+  // CHECK-FIXES: auto *b1 = dynamic_cast(a);
+
+  B &b2 = dynamic_cast(*a);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplicating the type name
+  // CHECK-FIXES: auto &b2 = dynamic_cast(*a);
+}
+
+void f_reinterpret_cast() {
+  auto *a = new A();
+  C *c1 = reinterpret_cast(a);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with a cast to avoid duplicating the type name
+  // CHECK-FIXES: auto *c1 = reinterpret_cast(a);
+
+  C &c2 = reinterpret_cast(*a);
+  // CH

[clang-tools-extra] r285579 - [clang-tidy] Enhance modernize-use-auto to casts

2016-10-31 Thread Malcolm Parsons via cfe-commits
Author: malcolm.parsons
Date: Mon Oct 31 09:43:37 2016
New Revision: 285579

URL: http://llvm.org/viewvc/llvm-project?rev=285579&view=rev
Log:
[clang-tidy] Enhance modernize-use-auto to casts

Summary:
Extend modernize-use-auto to cases when a variable is assigned with a cast.

e.g.
Type *Ptr1 = dynamic_cast(Ptr2);

http://llvm.org/PR25499

Reviewers: angelgarcia, aaron.ballman, klimek, Prazek, alexfh

Subscribers: Prazek, Eugene.Zelenko, cfe-commits

Tags: #clang-tools-extra

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

Added:

clang-tools-extra/trunk/test/clang-tidy/modernize-use-auto-cast-remove-stars.cpp
clang-tools-extra/trunk/test/clang-tidy/modernize-use-auto-cast.cpp
Modified:
clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.cpp
clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.h
clang-tools-extra/trunk/docs/ReleaseNotes.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-auto.rst
clang-tools-extra/trunk/test/clang-tidy/modernize-use-auto-new.cpp

Modified: clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.cpp?rev=285579&r1=285578&r2=285579&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.cpp Mon Oct 31 
09:43:37 2016
@@ -23,6 +23,7 @@ namespace {
 
 const char IteratorDeclStmtId[] = "iterator_decl";
 const char DeclWithNewId[] = "decl_new";
+const char DeclWithCastId[] = "decl_cast";
 
 /// \brief Matches variable declarations that have explicit initializers that
 /// are not initializer lists.
@@ -208,27 +209,18 @@ TypeMatcher iteratorFromUsingDeclaration
 /// \brief This matcher returns declaration statements that contain variable
 /// declarations with written non-list initializer for standard iterators.
 StatementMatcher makeIteratorDeclMatcher() {
-  return declStmt(
- // At least one varDecl should be a child of the declStmt to 
ensure
- // it's a declaration list and avoid matching other declarations,
- // e.g. using directives.
- has(varDecl()),
- unless(has(varDecl(anyOf(
- unless(hasWrittenNonListInitializer()), hasType(autoType()),
- unless(hasType(
- isSugarFor(anyOf(typedefIterator(), nestedIterator(),
-  iteratorFromUsingDeclaration())
+  return declStmt(unless(has(
+  varDecl(anyOf(unless(hasWrittenNonListInitializer()),
+unless(hasType(isSugarFor(anyOf(
+typedefIterator(), nestedIterator(),
+iteratorFromUsingDeclaration())
   .bind(IteratorDeclStmtId);
 }
 
 StatementMatcher makeDeclWithNewMatcher() {
   return declStmt(
- has(varDecl()),
  unless(has(varDecl(anyOf(
  unless(hasInitializer(ignoringParenImpCasts(cxxNewExpr(,
- // Skip declarations that are already using auto.
- anyOf(hasType(autoType()),
-   hasType(pointerType(pointee(autoType(),
  // FIXME: TypeLoc information is not reliable where CV
  // qualifiers are concerned so these types can't be
  // handled for now.
@@ -243,6 +235,26 @@ StatementMatcher makeDeclWithNewMatcher(
   .bind(DeclWithNewId);
 }
 
+StatementMatcher makeDeclWithCastMatcher() {
+  return declStmt(
+ unless(has(varDecl(unless(hasInitializer(explicitCastExpr()))
+  .bind(DeclWithCastId);
+}
+
+StatementMatcher makeCombinedMatcher() {
+  return declStmt(
+  // At least one varDecl should be a child of the declStmt to ensure
+  // it's a declaration list and avoid matching other declarations,
+  // e.g. using directives.
+  has(varDecl()),
+  // Skip declarations that are already using auto.
+  unless(has(varDecl(anyOf(hasType(autoType()),
+   hasType(pointerType(pointee(autoType(,
+   hasType(referenceType(pointee(autoType(,
+  anyOf(makeIteratorDeclMatcher(), makeDeclWithNewMatcher(),
+makeDeclWithCastMatcher()));
+}
+
 } // namespace
 
 UseAutoCheck::UseAutoCheck(StringRef Name, ClangTidyContext *Context)
@@ -257,8 +269,7 @@ void UseAutoCheck::registerMatchers(Matc
   // Only register the matchers for C++; the functionality currently does not
   // provide any benefit to other languages, despite being benign.
   if (getLangOpts().CPlusPlus) {
-Finder->addMatcher(makeIteratorDeclMatcher(), this);
-Finder->addMatcher(makeDeclWithNewMatcher(), this);
+Finder->addMatcher(makeCombinedMatcher(), this);
   }
 }
 
@@ -

[PATCH] D22725: [clang-tidy] Add check 'modernize-use-algorithm'

2016-10-31 Thread Alexander Kornienko via cfe-commits
alexfh requested changes to this revision.
alexfh added a comment.
This revision now requires changes to proceed.

Removing from my dashboard. Ping me once you have a new patch.


Repository:
  rL LLVM

https://reviews.llvm.org/D22725



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


[clang-tools-extra] r285581 - Fix link to check

2016-10-31 Thread Malcolm Parsons via cfe-commits
Author: malcolm.parsons
Date: Mon Oct 31 09:48:49 2016
New Revision: 285581

URL: http://llvm.org/viewvc/llvm-project?rev=285581&view=rev
Log:
Fix link to check

Modified:
clang-tools-extra/trunk/docs/ReleaseNotes.rst

Modified: clang-tools-extra/trunk/docs/ReleaseNotes.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/ReleaseNotes.rst?rev=285581&r1=285580&r2=285581&view=diff
==
--- clang-tools-extra/trunk/docs/ReleaseNotes.rst (original)
+++ clang-tools-extra/trunk/docs/ReleaseNotes.rst Mon Oct 31 09:48:49 2016
@@ -82,7 +82,7 @@ Improvements to clang-tidy
   reinitialization.
 
 - The `modernize-use-auto
-  `_ check
+  `_ 
check
   now warns about variable declarations that are initialized with a cast.
 
 - New `mpi-buffer-deref


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


[PATCH] D25316: [clang-tidy] Enhance modernize-use-auto to casts

2016-10-31 Thread Malcolm Parsons via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL285579: [clang-tidy] Enhance modernize-use-auto to casts 
(authored by malcolm.parsons).

Changed prior to commit:
  https://reviews.llvm.org/D25316?vs=76404&id=76405#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25316

Files:
  clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.cpp
  clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.h
  clang-tools-extra/trunk/docs/ReleaseNotes.rst
  clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-use-auto.rst
  
clang-tools-extra/trunk/test/clang-tidy/modernize-use-auto-cast-remove-stars.cpp
  clang-tools-extra/trunk/test/clang-tidy/modernize-use-auto-cast.cpp
  clang-tools-extra/trunk/test/clang-tidy/modernize-use-auto-new.cpp

Index: clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.cpp
===
--- clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/modernize/UseAutoCheck.cpp
@@ -23,6 +23,7 @@
 
 const char IteratorDeclStmtId[] = "iterator_decl";
 const char DeclWithNewId[] = "decl_new";
+const char DeclWithCastId[] = "decl_cast";
 
 /// \brief Matches variable declarations that have explicit initializers that
 /// are not initializer lists.
@@ -208,27 +209,18 @@
 /// \brief This matcher returns declaration statements that contain variable
 /// declarations with written non-list initializer for standard iterators.
 StatementMatcher makeIteratorDeclMatcher() {
-  return declStmt(
- // At least one varDecl should be a child of the declStmt to ensure
- // it's a declaration list and avoid matching other declarations,
- // e.g. using directives.
- has(varDecl()),
- unless(has(varDecl(anyOf(
- unless(hasWrittenNonListInitializer()), hasType(autoType()),
- unless(hasType(
- isSugarFor(anyOf(typedefIterator(), nestedIterator(),
-  iteratorFromUsingDeclaration())
+  return declStmt(unless(has(
+  varDecl(anyOf(unless(hasWrittenNonListInitializer()),
+unless(hasType(isSugarFor(anyOf(
+typedefIterator(), nestedIterator(),
+iteratorFromUsingDeclaration())
   .bind(IteratorDeclStmtId);
 }
 
 StatementMatcher makeDeclWithNewMatcher() {
   return declStmt(
- has(varDecl()),
  unless(has(varDecl(anyOf(
  unless(hasInitializer(ignoringParenImpCasts(cxxNewExpr(,
- // Skip declarations that are already using auto.
- anyOf(hasType(autoType()),
-   hasType(pointerType(pointee(autoType(),
  // FIXME: TypeLoc information is not reliable where CV
  // qualifiers are concerned so these types can't be
  // handled for now.
@@ -243,6 +235,26 @@
   .bind(DeclWithNewId);
 }
 
+StatementMatcher makeDeclWithCastMatcher() {
+  return declStmt(
+ unless(has(varDecl(unless(hasInitializer(explicitCastExpr()))
+  .bind(DeclWithCastId);
+}
+
+StatementMatcher makeCombinedMatcher() {
+  return declStmt(
+  // At least one varDecl should be a child of the declStmt to ensure
+  // it's a declaration list and avoid matching other declarations,
+  // e.g. using directives.
+  has(varDecl()),
+  // Skip declarations that are already using auto.
+  unless(has(varDecl(anyOf(hasType(autoType()),
+   hasType(pointerType(pointee(autoType(,
+   hasType(referenceType(pointee(autoType(,
+  anyOf(makeIteratorDeclMatcher(), makeDeclWithNewMatcher(),
+makeDeclWithCastMatcher()));
+}
+
 } // namespace
 
 UseAutoCheck::UseAutoCheck(StringRef Name, ClangTidyContext *Context)
@@ -257,8 +269,7 @@
   // Only register the matchers for C++; the functionality currently does not
   // provide any benefit to other languages, despite being benign.
   if (getLangOpts().CPlusPlus) {
-Finder->addMatcher(makeIteratorDeclMatcher(), this);
-Finder->addMatcher(makeDeclWithNewMatcher(), this);
+Finder->addMatcher(makeCombinedMatcher(), this);
   }
 }
 
@@ -313,7 +324,9 @@
   << FixItHint::CreateReplacement(Range, "auto");
 }
 
-void UseAutoCheck::replaceNew(const DeclStmt *D, ASTContext *Context) {
+void UseAutoCheck::replaceExpr(const DeclStmt *D, ASTContext *Context,
+   std::function GetType,
+   StringRef Message) {
   const auto *FirstDecl = dyn_cast(*D->decl_begin());
   // Ensure that there is at least one VarDecl within the DeclStmt.
   if (!FirstDecl)
@@ -328,13 +341,13 @@
 if (!V)
   return;
 
-const auto *NewExpr = cast(V->getInit()->Ign

[PATCH] D26150: [libc++abi] Fix test_exception_storage_nodynmem on MacOS

2016-10-31 Thread Shoaib Meenai via cfe-commits
smeenai created this revision.
smeenai added reviewers: compnerd, EricWF, howard.hinnant, ikudrin, mclow.lists.
smeenai added a subscriber: cfe-commits.

Mach-O defaults to two-level namespaces, so `calloc` cannot be
interpositoned. Override it via the default malloc zone instead.

Note: `DYLD_FORCE_FLAT_NAMESPACE` can be used to enable interpositioning
on Mach-O, but `calloc` is used during library initialization, so
replacing it with a version which always returns NULL causes segfaults.
This could be worked around, but malloc zones are a cleaner solution.


https://reviews.llvm.org/D26150

Files:
  test/test_exception_storage_nodynmem.pass.cpp


Index: test/test_exception_storage_nodynmem.pass.cpp
===
--- test/test_exception_storage_nodynmem.pass.cpp
+++ test/test_exception_storage_nodynmem.pass.cpp
@@ -17,16 +17,28 @@
 
 #include 
 #include 
+#if defined(__APPLE__)
+#include 
+#endif
 
 static bool OverwrittenCallocCalled = false;
 
 // Override calloc to simulate exhaustion of dynamic memory
+#if !defined(__APPLE__)
 void *calloc(size_t, size_t) {
+#else
+void *calloc(malloc_zone_t *, size_t, size_t) {
+#endif
 OverwrittenCallocCalled = true;
 return 0;
 }
 
 int main(int argc, char *argv[]) {
+#if defined(__APPLE__)
+malloc_zone_t *default_zone = malloc_default_zone();
+default_zone->calloc = calloc;
+#endif
+
 // Run the test a couple of times
 // to ensure that fallback memory doesn't leak.
 for (int I = 0; I < 1000; ++I)


Index: test/test_exception_storage_nodynmem.pass.cpp
===
--- test/test_exception_storage_nodynmem.pass.cpp
+++ test/test_exception_storage_nodynmem.pass.cpp
@@ -17,16 +17,28 @@
 
 #include 
 #include 
+#if defined(__APPLE__)
+#include 
+#endif
 
 static bool OverwrittenCallocCalled = false;
 
 // Override calloc to simulate exhaustion of dynamic memory
+#if !defined(__APPLE__)
 void *calloc(size_t, size_t) {
+#else
+void *calloc(malloc_zone_t *, size_t, size_t) {
+#endif
 OverwrittenCallocCalled = true;
 return 0;
 }
 
 int main(int argc, char *argv[]) {
+#if defined(__APPLE__)
+malloc_zone_t *default_zone = malloc_default_zone();
+default_zone->calloc = calloc;
+#endif
+
 // Run the test a couple of times
 // to ensure that fallback memory doesn't leak.
 for (int I = 0; I < 1000; ++I)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D26138: [clang-tidy] Add modernize-use-delete check

2016-10-31 Thread Malcolm Parsons via cfe-commits
malcolm.parsons updated this revision to Diff 76410.
malcolm.parsons added a comment.

Add to release notes.


https://reviews.llvm.org/D26138

Files:
  clang-tidy/modernize/CMakeLists.txt
  clang-tidy/modernize/ModernizeTidyModule.cpp
  clang-tidy/modernize/UseDeleteCheck.cpp
  clang-tidy/modernize/UseDeleteCheck.h
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/modernize-use-delete.rst
  test/clang-tidy/modernize-use-delete.cpp

Index: test/clang-tidy/modernize-use-delete.cpp
===
--- /dev/null
+++ test/clang-tidy/modernize-use-delete.cpp
@@ -0,0 +1,122 @@
+// RUN: %check_clang_tidy %s modernize-use-delete %t
+
+struct PositivePrivate {
+private:
+  PositivePrivate();
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= delete' to prevent a default special member function [modernize-use-delete]
+  // CHECK-FIXES: PositivePrivate() = delete;
+  PositivePrivate(const PositivePrivate &);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= delete' to prevent a default special member function [modernize-use-delete]
+  // CHECK-FIXES: PositivePrivate(const PositivePrivate &) = delete;
+  PositivePrivate &operator=(const PositivePrivate &);
+  // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: use '= delete' to prevent a default special member function [modernize-use-delete]
+  // CHECK-FIXES: PositivePrivate &operator=(const PositivePrivate &) = delete;
+  PositivePrivate(PositivePrivate &&);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= delete' to prevent a default special member function [modernize-use-delete]
+  // CHECK-FIXES: PositivePrivate(PositivePrivate &&) = delete;
+  PositivePrivate &operator=(PositivePrivate &&);
+  // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: use '= delete' to prevent a default special member function [modernize-use-delete]
+  // CHECK-FIXES: PositivePrivate &operator=(PositivePrivate &&) = delete;
+  ~PositivePrivate();
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= delete' to prevent a default special member function [modernize-use-delete]
+  // CHECK-FIXES: ~PositivePrivate() = delete;
+};
+
+struct NegativePublic {
+  NegativePublic(const NegativePublic &);
+};
+
+struct NegativeProtected {
+protected:
+  NegativeProtected(const NegativeProtected &);
+};
+
+struct PositiveInlineMember {
+  int foo() { return 0; }
+
+private:
+  PositiveInlineMember(const PositiveInlineMember &);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= delete' to prevent a default special member function [modernize-use-delete]
+  // CHECK-FIXES: PositiveInlineMember(const PositiveInlineMember &) = delete;
+};
+
+struct PositiveOutOfLineMember {
+  int foo();
+
+private:
+  PositiveOutOfLineMember(const PositiveOutOfLineMember &);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= delete' to prevent a default special member function [modernize-use-delete]
+  // CHECK-FIXES: PositiveOutOfLineMember(const PositiveOutOfLineMember &) = delete;
+};
+
+int PositiveOutOfLineMember::foo() { return 0; }
+
+struct PositiveAbstractMember {
+  virtual int foo() = 0;
+
+private:
+  PositiveAbstractMember(const PositiveAbstractMember &);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= delete' to prevent a default special member function [modernize-use-delete]
+  // CHECK-FIXES: PositiveAbstractMember(const PositiveAbstractMember &) = delete;
+};
+
+struct NegativeMemberNotImpl {
+  int foo();
+
+private:
+  NegativeMemberNotImpl(const NegativeMemberNotImpl &);
+};
+
+struct NegativeStaticMemberNotImpl {
+  static int foo();
+
+private:
+  NegativeStaticMemberNotImpl(const NegativeStaticMemberNotImpl &);
+};
+
+struct NegativeInline {
+private:
+  NegativeInline(const NegativeInline &) {}
+};
+
+struct NegativeOutOfLine {
+private:
+  NegativeOutOfLine(const NegativeOutOfLine &);
+};
+
+NegativeOutOfLine::NegativeOutOfLine(const NegativeOutOfLine &) {}
+
+struct NegativeConstructNotImpl {
+  NegativeConstructNotImpl();
+
+private:
+  NegativeConstructNotImpl(const NegativeConstructNotImpl &);
+};
+
+struct PositiveDefaultedConstruct {
+  PositiveDefaultedConstruct() = default;
+
+private:
+  PositiveDefaultedConstruct(const PositiveDefaultedConstruct &);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= delete' to prevent a default special member function [modernize-use-delete]
+  // CHECK-FIXES: PositiveDefaultedConstruct(const PositiveDefaultedConstruct &) = delete;
+};
+
+struct PositiveDeletedConstruct {
+  PositiveDeletedConstruct() = delete;
+
+private:
+  PositiveDeletedConstruct(const PositiveDeletedConstruct &);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= delete' to prevent a default special member function [modernize-use-delete]
+  // CHECK-FIXES: PositiveDeletedConstruct(const PositiveDeletedConstruct &) = delete;
+};
+
+struct NegativeDefaulted {
+private:
+  NegativeDefaulted(const NegativeDefaulted &) = default;
+};
+
+struct NegativeDeleted {
+private:
+  NegativeDel

[libcxx] r285582 - [libc++] Add configuration define for off_t functions

2016-10-31 Thread Shoaib Meenai via cfe-commits
Author: smeenai
Date: Mon Oct 31 10:09:10 2016
New Revision: 285582

URL: http://llvm.org/viewvc/llvm-project?rev=285582&view=rev
Log:
[libc++] Add configuration define for off_t functions

Create this define in __config and use it elsewhere, instead of checking
the operating system/library defines in other files. The aim is to
reduce the usage of _WIN32 outside __config. No functional change.

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

Modified:
libcxx/trunk/include/__config
libcxx/trunk/include/fstream

Modified: libcxx/trunk/include/__config
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=285582&r1=285581&r2=285582&view=diff
==
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Mon Oct 31 10:09:10 2016
@@ -904,6 +904,12 @@ extern "C" void __sanitizer_annotate_con
 #define _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
 #endif
 
+#if !defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS)
+#if defined(_WIN32) || defined(_NEWLIB_VERSION)
+#define _LIBCPP_HAS_NO_OFF_T_FUNCTIONS
+#endif
+#endif
+
 #endif // __cplusplus
 
 #endif // _LIBCPP_CONFIG

Modified: libcxx/trunk/include/fstream
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/fstream?rev=285582&r1=285581&r2=285582&view=diff
==
--- libcxx/trunk/include/fstream (original)
+++ libcxx/trunk/include/fstream Mon Oct 31 10:09:10 2016
@@ -813,7 +813,7 @@ basic_filebuf<_CharT, _Traits>::seekoff(
 default:
 return pos_type(off_type(-1));
 }
-#if defined(_WIN32) || defined(_NEWLIB_VERSION)
+#if defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS)
 if (fseek(__file_, __width > 0 ? __width * __off : 0, __whence))
 return pos_type(off_type(-1));
 pos_type __r = ftell(__file_);
@@ -832,7 +832,7 @@ basic_filebuf<_CharT, _Traits>::seekpos(
 {
 if (__file_ == 0 || sync())
 return pos_type(off_type(-1));
-#if defined(_WIN32) || defined(_NEWLIB_VERSION)
+#if defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS)
 if (fseek(__file_, __sp, SEEK_SET))
 return pos_type(off_type(-1));
 #else
@@ -896,7 +896,7 @@ basic_filebuf<_CharT, _Traits>::sync()
 }
 }
 }
-#if defined(_WIN32) || defined(_NEWLIB_VERSION)
+#if defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS)
 if (fseek(__file_, -__c, SEEK_CUR))
 return -1;
 #else


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


[PATCH] D25741: [libc++] Add configuration define for off_t functions

2016-10-31 Thread Shoaib Meenai via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL285582: [libc++] Add configuration define for off_t 
functions (authored by smeenai).

Changed prior to commit:
  https://reviews.llvm.org/D25741?vs=75142&id=76411#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25741

Files:
  libcxx/trunk/include/__config
  libcxx/trunk/include/fstream


Index: libcxx/trunk/include/fstream
===
--- libcxx/trunk/include/fstream
+++ libcxx/trunk/include/fstream
@@ -813,7 +813,7 @@
 default:
 return pos_type(off_type(-1));
 }
-#if defined(_WIN32) || defined(_NEWLIB_VERSION)
+#if defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS)
 if (fseek(__file_, __width > 0 ? __width * __off : 0, __whence))
 return pos_type(off_type(-1));
 pos_type __r = ftell(__file_);
@@ -832,7 +832,7 @@
 {
 if (__file_ == 0 || sync())
 return pos_type(off_type(-1));
-#if defined(_WIN32) || defined(_NEWLIB_VERSION)
+#if defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS)
 if (fseek(__file_, __sp, SEEK_SET))
 return pos_type(off_type(-1));
 #else
@@ -896,7 +896,7 @@
 }
 }
 }
-#if defined(_WIN32) || defined(_NEWLIB_VERSION)
+#if defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS)
 if (fseek(__file_, -__c, SEEK_CUR))
 return -1;
 #else
Index: libcxx/trunk/include/__config
===
--- libcxx/trunk/include/__config
+++ libcxx/trunk/include/__config
@@ -904,6 +904,12 @@
 #define _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
 #endif
 
+#if !defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS)
+#if defined(_WIN32) || defined(_NEWLIB_VERSION)
+#define _LIBCPP_HAS_NO_OFF_T_FUNCTIONS
+#endif
+#endif
+
 #endif // __cplusplus
 
 #endif // _LIBCPP_CONFIG


Index: libcxx/trunk/include/fstream
===
--- libcxx/trunk/include/fstream
+++ libcxx/trunk/include/fstream
@@ -813,7 +813,7 @@
 default:
 return pos_type(off_type(-1));
 }
-#if defined(_WIN32) || defined(_NEWLIB_VERSION)
+#if defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS)
 if (fseek(__file_, __width > 0 ? __width * __off : 0, __whence))
 return pos_type(off_type(-1));
 pos_type __r = ftell(__file_);
@@ -832,7 +832,7 @@
 {
 if (__file_ == 0 || sync())
 return pos_type(off_type(-1));
-#if defined(_WIN32) || defined(_NEWLIB_VERSION)
+#if defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS)
 if (fseek(__file_, __sp, SEEK_SET))
 return pos_type(off_type(-1));
 #else
@@ -896,7 +896,7 @@
 }
 }
 }
-#if defined(_WIN32) || defined(_NEWLIB_VERSION)
+#if defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS)
 if (fseek(__file_, -__c, SEEK_CUR))
 return -1;
 #else
Index: libcxx/trunk/include/__config
===
--- libcxx/trunk/include/__config
+++ libcxx/trunk/include/__config
@@ -904,6 +904,12 @@
 #define _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
 #endif
 
+#if !defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS)
+#if defined(_WIN32) || defined(_NEWLIB_VERSION)
+#define _LIBCPP_HAS_NO_OFF_T_FUNCTIONS
+#endif
+#endif
+
 #endif // __cplusplus
 
 #endif // _LIBCPP_CONFIG
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r285583 - Add -frtti for Windows buildbot.

2016-10-31 Thread Malcolm Parsons via cfe-commits
Author: malcolm.parsons
Date: Mon Oct 31 10:15:00 2016
New Revision: 285583

URL: http://llvm.org/viewvc/llvm-project?rev=285583&view=rev
Log:
Add -frtti for Windows buildbot.

Modified:

clang-tools-extra/trunk/test/clang-tidy/modernize-use-auto-cast-remove-stars.cpp
clang-tools-extra/trunk/test/clang-tidy/modernize-use-auto-cast.cpp

Modified: 
clang-tools-extra/trunk/test/clang-tidy/modernize-use-auto-cast-remove-stars.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/modernize-use-auto-cast-remove-stars.cpp?rev=285583&r1=285582&r2=285583&view=diff
==
--- 
clang-tools-extra/trunk/test/clang-tidy/modernize-use-auto-cast-remove-stars.cpp
 (original)
+++ 
clang-tools-extra/trunk/test/clang-tidy/modernize-use-auto-cast-remove-stars.cpp
 Mon Oct 31 10:15:00 2016
@@ -1,6 +1,6 @@
 // RUN: %check_clang_tidy %s modernize-use-auto %t -- \
 // RUN:   -config="{CheckOptions: [{key: modernize-use-auto.RemoveStars, 
value: '1'}]}" \
-// RUN:   -- -std=c++11
+// RUN:   -- -std=c++11 -frtti
 
 struct A {
   virtual ~A() {}

Modified: clang-tools-extra/trunk/test/clang-tidy/modernize-use-auto-cast.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/modernize-use-auto-cast.cpp?rev=285583&r1=285582&r2=285583&view=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/modernize-use-auto-cast.cpp 
(original)
+++ clang-tools-extra/trunk/test/clang-tidy/modernize-use-auto-cast.cpp Mon Oct 
31 10:15:00 2016
@@ -1,5 +1,5 @@
 // RUN: %check_clang_tidy %s modernize-use-auto %t -- -- \
-// RUN:   -std=c++11 -I %S/Inputs/modernize-use-auto
+// RUN:   -std=c++11 -I %S/Inputs/modernize-use-auto -frtti
 
 struct A {
   virtual ~A() {}


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


Re: [PATCH] D26024: [Xray] Don't generate output for xray tests

2016-10-31 Thread David Blaikie via cfe-commits
How/what output are these producing if they're meant to fail ("not" in the
test line) anyway?

& these tests should probably check the diagnostic result to be more
precise than "Clang exited with a non-zero exit code".

On Thu, Oct 27, 2016 at 1:54 AM Dean Michael Berris via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> dberris accepted this revision.
> dberris added a comment.
>
> Yes, thanks (and sorry for missing this).
>
>
> https://reviews.llvm.org/D26024
>
>
>
> ___
> 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: r285289 - [Sema] -Wunused-variable warning for array variables should behave

2016-10-31 Thread David Blaikie via cfe-commits
On Thu, Oct 27, 2016 at 6:40 AM Alex Lorenz via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: arphaman
> Date: Thu Oct 27 08:30:51 2016
> New Revision: 285289
>
> URL: http://llvm.org/viewvc/llvm-project?rev=285289&view=rev
> Log:
> [Sema] -Wunused-variable warning for array variables should behave
> similarly to scalar variables.
>
> This commit makes the -Wunused-variable warning behaviour more consistent:
> Now clang won't warn for array variables where it doesn't warn for scalar
> variables.
>
> rdar://24158862
>
> Differential Revision: https://reviews.llvm.org/D25937
>
> Modified:
> cfe/trunk/lib/Sema/SemaDecl.cpp
> cfe/trunk/test/SemaCXX/warn-everthing.cpp
> cfe/trunk/test/SemaCXX/warn-unused-variables.cpp
>
> Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=285289&r1=285288&r2=285289&view=diff
>
> ==
> --- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Oct 27 08:30:51 2016
> @@ -1522,7 +1522,7 @@ static bool ShouldDiagnoseUnusedDecl(con
>if (const VarDecl *VD = dyn_cast(D)) {
>
>  // White-list anything with an __attribute__((unused)) type.
> -QualType Ty = VD->getType();
> +const auto *Ty = VD->getType().getTypePtr();
>
>  // Only look at the outermost level of typedef.
>  if (const TypedefType *TT = Ty->getAs()) {
> @@ -1535,6 +1535,10 @@ static bool ShouldDiagnoseUnusedDecl(con
>  if (Ty->isIncompleteType() || Ty->isDependentType())
>return false;
>
> +// Look at the element type to ensure that the warning behaviour is
> +// consistent for both scalars and arrays.
> +Ty = Ty->getBaseElementTypeUnsafe();
> +
>  if (const TagType *TT = Ty->getAs()) {
>const TagDecl *Tag = TT->getDecl();
>if (Tag->hasAttr())
>
> Modified: cfe/trunk/test/SemaCXX/warn-everthing.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-everthing.cpp?rev=285289&r1=285288&r2=285289&view=diff
>
> ==
> --- cfe/trunk/test/SemaCXX/warn-everthing.cpp (original)
> +++ cfe/trunk/test/SemaCXX/warn-everthing.cpp Thu Oct 27 08:30:51 2016
> @@ -9,5 +9,5 @@ public:
>  };
>
>  void testPR12271() { // expected-warning {{no previous prototype for
> function 'testPR12271'}}
> -  PR12271 a[1][1]; // expected-warning {{unused variable 'a'}}
> +  PR12271 a[1][1];
>  }
>
> Modified: cfe/trunk/test/SemaCXX/warn-unused-variables.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-unused-variables.cpp?rev=285289&r1=285288&r2=285289&view=diff
>
> ==
> --- cfe/trunk/test/SemaCXX/warn-unused-variables.cpp (original)
> +++ cfe/trunk/test/SemaCXX/warn-unused-variables.cpp Thu Oct 27 08:30:51
> 2016
> @@ -150,3 +150,54 @@ namespace ctor_with_cleanups {
>  }
>
>  #include "Inputs/warn-unused-variables.h"
> +
> +namespace arrayRecords {
> +
> +int total = 0;
> +
> +class Adder {
>

Presumably this class could be a bit simpler - is it just about having a
non-trivial ctor? or non-trivial dtor?

It'd be helpful to make the test as simple as possible to show what
features are important to the diagnostic - rather than making the test look
like real code by having functionality that's not required for testing.

(eg: you don't have to implement functions here - the code will not be
linked or executed, just compiled for warnings in the test suite)

Potentially name the class by its purpose:

struct NonTriviallyDestructible {
  ~NonTriviallyDestructible();
};

and similar.

(is it important that Adder and Foo are constructed with arguments/have
ctor parameters? It's not clear to me from the test or code whether that's
the case)


> +public:
> +  Adder(int x); // out of line below
> +  ~Adder() {}
> +};
> +
> +Adder::Adder(int x) {
> +  total += x;
> +}
> +
> +struct Foo {
> +  int x;
> +  Foo(int x) : x(x) {}
> +};
> +
> +struct S1 {
> +  S1();
> +};
> +
> +void foo(int size) {
> +  S1 y; // no warning
> +  S1 yarray[2]; // no warning
> +  S1 dynArray[size]; // no warning
> +  S1 nestedArray[1][2][3]; // no warning
> +
> +  Adder scalerInFuncScope = 134; // no warning
> +  Adder arrayInFuncScope[] = { 135, 136 };  // no warning
> +  Adder nestedArrayInFuncScope[2][2] = { {1,2}, {3,4} }; // no warning
> +
> +  Foo fooScalar = 1; // expected-warning {{unused variable 'fooScalar'}}
> +  Foo fooArray[] = {1,2}; // expected-warning {{unused variable
> 'fooArray'}}
> +  Foo fooNested[2][2] = { {1,2}, {3,4} }; // expected-warning {{unused
> variable 'fooNested'}}
> +}
> +
> +template
> +void bar() {
> +  Adder scaler = 123; // no warning
> +  Adder array[N] = {1,2}; // no warning
> +}
> +
> +void test() {
> +  foo(10);
> +  bar<2>();
> +}
> +
> +}
>
>
> 

[PATCH] D25012: [x86][inline-asm] Add support for curly brackets escape using "%" in extended inline asm.

2016-10-31 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL285585: [x86][inline-asm] Add support for curly brackets 
escape using "%" in extended… (authored by mzuckerm).

Changed prior to commit:
  https://reviews.llvm.org/D25012?vs=73602&id=76415#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25012

Files:
  cfe/trunk/lib/AST/Stmt.cpp
  cfe/trunk/test/CodeGen/x86_inlineasm_curly_bracket_escape.c


Index: cfe/trunk/test/CodeGen/x86_inlineasm_curly_bracket_escape.c
===
--- cfe/trunk/test/CodeGen/x86_inlineasm_curly_bracket_escape.c
+++ cfe/trunk/test/CodeGen/x86_inlineasm_curly_bracket_escape.c
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -target-cpu skylake-avx512 
-O0  -S -emit-llvm -o - -Wall -Werror | FileCheck %s
+// This test checks validity of inline assembly using curly brackets syntax
+// for extended inline asm.
+
+void test_curly_brackets() {
+//CHECK:  %xmm1,%xmm0,%xmm1 {%k1}{z}
+asm("vpaddb\t %%xmm1,%%xmm0,%%xmm1 %{%%k1%}%{z%}\t":::);
+}
\ No newline at end of file
Index: cfe/trunk/lib/AST/Stmt.cpp
===
--- cfe/trunk/lib/AST/Stmt.cpp
+++ cfe/trunk/lib/AST/Stmt.cpp
@@ -533,15 +533,17 @@
   DiagOffs = CurPtr-StrStart-1;
   return diag::err_asm_invalid_escape;
 }
-
+// Handle escaped char and continue looping over the asm string.
 char EscapedChar = *CurPtr++;
-if (EscapedChar == '%') {  // %% -> %
-  // Escaped percentage sign.
-  CurStringPiece += '%';
+switch (EscapedChar) {
+default:
+  break;
+case '%': // %% -> %
+case '{': // %{ -> {
+case '}': // %} -> }
+  CurStringPiece += EscapedChar;
   continue;
-}
-
-if (EscapedChar == '=') {  // %= -> Generate an unique ID.
+case '=': // %= -> Generate a unique ID.
   CurStringPiece += "${:uid}";
   continue;
 }


Index: cfe/trunk/test/CodeGen/x86_inlineasm_curly_bracket_escape.c
===
--- cfe/trunk/test/CodeGen/x86_inlineasm_curly_bracket_escape.c
+++ cfe/trunk/test/CodeGen/x86_inlineasm_curly_bracket_escape.c
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -target-cpu skylake-avx512 -O0  -S -emit-llvm -o - -Wall -Werror | FileCheck %s
+// This test checks validity of inline assembly using curly brackets syntax
+// for extended inline asm.
+
+void test_curly_brackets() {
+//CHECK:  %xmm1,%xmm0,%xmm1 {%k1}{z}
+asm("vpaddb\t %%xmm1,%%xmm0,%%xmm1 %{%%k1%}%{z%}\t":::);
+}
\ No newline at end of file
Index: cfe/trunk/lib/AST/Stmt.cpp
===
--- cfe/trunk/lib/AST/Stmt.cpp
+++ cfe/trunk/lib/AST/Stmt.cpp
@@ -533,15 +533,17 @@
   DiagOffs = CurPtr-StrStart-1;
   return diag::err_asm_invalid_escape;
 }
-
+// Handle escaped char and continue looping over the asm string.
 char EscapedChar = *CurPtr++;
-if (EscapedChar == '%') {  // %% -> %
-  // Escaped percentage sign.
-  CurStringPiece += '%';
+switch (EscapedChar) {
+default:
+  break;
+case '%': // %% -> %
+case '{': // %{ -> {
+case '}': // %} -> }
+  CurStringPiece += EscapedChar;
   continue;
-}
-
-if (EscapedChar == '=') {  // %= -> Generate an unique ID.
+case '=': // %= -> Generate a unique ID.
   CurStringPiece += "${:uid}";
   continue;
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r285585 - [x86][inline-asm] Add support for curly brackets escape using "%" in extended inline asm.

2016-10-31 Thread Michael Zuckerman via cfe-commits
Author: mzuckerm
Date: Mon Oct 31 10:27:54 2016
New Revision: 285585

URL: http://llvm.org/viewvc/llvm-project?rev=285585&view=rev
Log:
[x86][inline-asm] Add support for curly brackets escape using "%" in extended 
inline asm.

Commit on behalf of mharoush

After LGTM and check all:

This patch is a compatibility fix for clang, matching GCC support for charter 
escape when using extended in-line assembly (i.e, "%{" ,"%}" --> "{" ,"}" ).
 It is meant to enable support for advanced features such as AVX512 
conditional\masked vector instructions/broadcast assembly syntax.

Reviewer: 1. rnk

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


Added:
cfe/trunk/test/CodeGen/x86_inlineasm_curly_bracket_escape.c
Modified:
cfe/trunk/lib/AST/Stmt.cpp

Modified: cfe/trunk/lib/AST/Stmt.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Stmt.cpp?rev=285585&r1=285584&r2=285585&view=diff
==
--- cfe/trunk/lib/AST/Stmt.cpp (original)
+++ cfe/trunk/lib/AST/Stmt.cpp Mon Oct 31 10:27:54 2016
@@ -533,15 +533,17 @@ unsigned GCCAsmStmt::AnalyzeAsmString(Sm
   DiagOffs = CurPtr-StrStart-1;
   return diag::err_asm_invalid_escape;
 }
-
+// Handle escaped char and continue looping over the asm string.
 char EscapedChar = *CurPtr++;
-if (EscapedChar == '%') {  // %% -> %
-  // Escaped percentage sign.
-  CurStringPiece += '%';
+switch (EscapedChar) {
+default:
+  break;
+case '%': // %% -> %
+case '{': // %{ -> {
+case '}': // %} -> }
+  CurStringPiece += EscapedChar;
   continue;
-}
-
-if (EscapedChar == '=') {  // %= -> Generate an unique ID.
+case '=': // %= -> Generate a unique ID.
   CurStringPiece += "${:uid}";
   continue;
 }

Added: cfe/trunk/test/CodeGen/x86_inlineasm_curly_bracket_escape.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/x86_inlineasm_curly_bracket_escape.c?rev=285585&view=auto
==
--- cfe/trunk/test/CodeGen/x86_inlineasm_curly_bracket_escape.c (added)
+++ cfe/trunk/test/CodeGen/x86_inlineasm_curly_bracket_escape.c Mon Oct 31 
10:27:54 2016
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -target-cpu skylake-avx512 
-O0  -S -emit-llvm -o - -Wall -Werror | FileCheck %s
+// This test checks validity of inline assembly using curly brackets syntax
+// for extended inline asm.
+
+void test_curly_brackets() {
+//CHECK:  %xmm1,%xmm0,%xmm1 {%k1}{z}
+asm("vpaddb\t %%xmm1,%%xmm0,%%xmm1 %{%%k1%}%{z%}\t":::);
+}
\ No newline at end of file


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


[PATCH] D25898: [clang-tidy] Enhance modernize-make-unique to handle unique_ptr.reset()

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

LGTM!


https://reviews.llvm.org/D25898



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


Re: [PATCH] D25990: Sema: do not warn about unused const vars if main file is a header

2016-10-31 Thread David Blaikie via cfe-commits
On Thu, Oct 27, 2016 at 6:02 AM Benjamin Kramer via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> bkramer accepted this revision.
> bkramer added a comment.
> This revision is now accepted and ready to land.
>
> This makes sense. While variable definitions in a header are weird, the
> warning that they're unused isn't adding any value.
>

I'm not sure that's true - the warning will then fire for users of the
header that don't use the variable...

I'd like to know about the mistake ahead of time to avoid breaking my users.

(yes, certain headers could require their variables to be used - but that
is a slightly niche requirement that could be addressed with a ((used))
attribute)

Also - does the same thing apply to static functions in headers?

- Dave


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


[PATCH] D26032: [ASTMatcher] Add CXXNewExpr support to hasDeclaration

2016-10-31 Thread Aaron Ballman via cfe-commits
aaron.ballman added a reviewer: lukasza.
aaron.ballman added a subscriber: lukasza.
aaron.ballman added a comment.

I think this is the right way to go, but I know that @klimek and @lukasza have 
been working on `hasDeclaration()` issues recently, so I am wondering what 
their thoughts are as well.


https://reviews.llvm.org/D26032



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


[PATCH] D25898: [clang-tidy] Enhance modernize-make-unique to handle unique_ptr.reset()

2016-10-31 Thread Malcolm Parsons via cfe-commits
malcolm.parsons updated this revision to Diff 76418.
malcolm.parsons added a comment.

Rebase.


https://reviews.llvm.org/D25898

Files:
  clang-tidy/modernize/MakeSmartPtrCheck.cpp
  clang-tidy/modernize/MakeSmartPtrCheck.h
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/modernize-make-shared.rst
  docs/clang-tidy/checks/modernize-make-unique.rst
  test/clang-tidy/modernize-make-shared.cpp
  test/clang-tidy/modernize-make-unique.cpp

Index: test/clang-tidy/modernize-make-unique.cpp
===
--- test/clang-tidy/modernize-make-unique.cpp
+++ test/clang-tidy/modernize-make-unique.cpp
@@ -8,6 +8,7 @@
 template >
 class unique_ptr {
 public:
+  unique_ptr();
   unique_ptr(type *ptr);
   unique_ptr(const unique_ptr &t) = delete;
   unique_ptr(unique_ptr &&t);
@@ -17,11 +18,13 @@
   type *release();
   void reset();
   void reset(type *pt);
+  unique_ptr &operator=(unique_ptr &&);
+  template 
+  unique_ptr &operator=(unique_ptr &&);
 
 private:
   type *ptr;
 };
-
 }
 
 struct Base {
@@ -46,7 +49,8 @@
 
 struct Empty {};
 
-template using unique_ptr_ = std::unique_ptr;
+template 
+using unique_ptr_ = std::unique_ptr;
 
 void *operator new(__SIZE_TYPE__ Count, void *Ptr);
 
@@ -63,11 +67,27 @@
   // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: use std::make_unique instead [modernize-make-unique]
   // CHECK-FIXES: std::unique_ptr P1 = std::make_unique();
 
+  P1.reset(new int());
+  // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: use std::make_unique instead [modernize-make-unique]
+  // CHECK-FIXES: P1 = std::make_unique();
+
+  P1 = std::unique_ptr(new int());
+  // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: use std::make_unique instead [modernize-make-unique]
+  // CHECK-FIXES: P1 = std::make_unique();
+
   // Without parenthesis.
   std::unique_ptr P2 = std::unique_ptr(new int);
   // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: use std::make_unique instead [modernize-make-unique]
   // CHECK-FIXES: std::unique_ptr P2 = std::make_unique();
 
+  P2.reset(new int);
+  // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: use std::make_unique instead [modernize-make-unique]
+  // CHECK-FIXES: P2 = std::make_unique();
+
+  P2 = std::unique_ptr(new int);
+  // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: use std::make_unique instead [modernize-make-unique]
+  // CHECK-FIXES: P2 = std::make_unique();
+
   // With auto.
   auto P3 = std::unique_ptr(new int());
   // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: use std::make_unique instead
@@ -79,6 +99,10 @@
 unique_ptr Q = unique_ptr(new int());
 // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: use std::make_unique instead
 // CHECK-FIXES: unique_ptr Q = std::make_unique();
+
+Q = unique_ptr(new int());
+// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: use std::make_unique instead
+// CHECK-FIXES: Q = std::make_unique();
   }
 
   std::unique_ptr R(new int());
@@ -88,19 +112,36 @@
   // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: use std::make_unique instead
   // CHECK-FIXES: int T = g(std::make_unique());
 
-  // Only replace if the type in the template is the same than the type returned
+  // Only replace if the type in the template is the same as the type returned
   // by the new operator.
   auto Pderived = std::unique_ptr(new Derived());
 
+  // OK to replace for reset and assign
+  Pderived.reset(new Derived());
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: use std::make_unique instead
+  // CHECK-FIXES: Pderived = std::make_unique();
+
+  Pderived = std::unique_ptr(new Derived());
+  // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: use std::make_unique instead
+  // CHECK-FIXES: Pderived = std::make_unique();
+
+  // FIXME: OK to replace if assigned to unique_ptr
+  Pderived = std::unique_ptr(new Derived());
+
+  // FIXME: OK to replace when auto is not used
+  std::unique_ptr PBase = std::unique_ptr(new Derived());
+
   // The pointer is returned by the function, nothing to do.
   std::unique_ptr RetPtr = getPointer();
 
   // This emulates std::move.
-  std::unique_ptr Move = static_cast&&>(P1);
+  std::unique_ptr Move = static_cast &&>(P1);
 
-  // Placemenet arguments should not be removed.
+  // Placement arguments should not be removed.
   int *PInt = new int;
   std::unique_ptr Placement = std::unique_ptr(new (PInt) int{3});
+  Placement.reset(new (PInt) int{3});
+  Placement = std::unique_ptr(new (PInt) int{3});
 }
 
 // Calling make_smart_ptr from within a member function of a type with a
@@ -116,6 +157,8 @@
 // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: use std::make_unique instead
 // CHECK-FIXES: auto callsPublic = std::make_unique();
 auto ptr = std::unique_ptr(new Private(42));
+ptr.reset(new Private(42));
+ptr = std::unique_ptr(new Private(42));
   }
 
   virtual ~Private();
@@ -132,6 +175,8 @@
 // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: use std::make_unique instead
 // CHECK-FIXES: auto callsPublic = std::make_unique(1, 2);
 auto ptr = std::unique_ptr(new Protected);

[clang-tools-extra] r285589 - [clang-tidy] Enhance modernize-make-unique to handle unique_ptr.reset()

2016-10-31 Thread Malcolm Parsons via cfe-commits
Author: malcolm.parsons
Date: Mon Oct 31 10:48:01 2016
New Revision: 285589

URL: http://llvm.org/viewvc/llvm-project?rev=285589&view=rev
Log:
[clang-tidy] Enhance modernize-make-unique to handle unique_ptr.reset()

Summary:
Avoid naked new in unique_ptr.reset() by using make_unique

Fixes http://llvm.org/PR27383

Reviewers: alexfh, aaron.ballman

Subscribers: Prazek, cfe-commits

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

Modified:
clang-tools-extra/trunk/clang-tidy/modernize/MakeSmartPtrCheck.cpp
clang-tools-extra/trunk/clang-tidy/modernize/MakeSmartPtrCheck.h
clang-tools-extra/trunk/docs/ReleaseNotes.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-make-shared.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-make-unique.rst
clang-tools-extra/trunk/test/clang-tidy/modernize-make-shared.cpp
clang-tools-extra/trunk/test/clang-tidy/modernize-make-unique.cpp

Modified: clang-tools-extra/trunk/clang-tidy/modernize/MakeSmartPtrCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/MakeSmartPtrCheck.cpp?rev=285589&r1=285588&r2=285589&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/modernize/MakeSmartPtrCheck.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/MakeSmartPtrCheck.cpp Mon Oct 
31 10:48:01 2016
@@ -18,6 +18,7 @@ namespace modernize {
 
 const char MakeSmartPtrCheck::PointerType[] = "pointerType";
 const char MakeSmartPtrCheck::ConstructorCall[] = "constructorCall";
+const char MakeSmartPtrCheck::ResetCall[] = "resetCall";
 const char MakeSmartPtrCheck::NewExpression[] = "newExpression";
 
 MakeSmartPtrCheck::MakeSmartPtrCheck(StringRef Name, ClangTidyContext *Context,
@@ -31,8 +32,8 @@ void MakeSmartPtrCheck::registerMatchers
 
   // Calling make_smart_ptr from within a member function of a type with a
   // private or protected constructor would be ill-formed.
-  auto CanCallCtor = unless(has(ignoringImpCasts(cxxConstructExpr(
-  hasDeclaration(decl(unless(isPublic(;
+  auto CanCallCtor = unless(has(ignoringImpCasts(
+  cxxConstructExpr(hasDeclaration(decl(unless(isPublic(;
 
   Finder->addMatcher(
   cxxBindTemporaryExpr(has(ignoringParenImpCasts(
@@ -45,6 +46,14 @@ void MakeSmartPtrCheck::registerMatchers
   .bind(NewExpression)))
   .bind(ConstructorCall,
   this);
+
+  Finder->addMatcher(
+  cxxMemberCallExpr(
+  thisPointerType(getSmartPointerTypeMatcher()),
+  callee(cxxMethodDecl(hasName("reset"))),
+  hasArgument(0, cxxNewExpr(CanCallCtor).bind(NewExpression)))
+  .bind(ResetCall),
+  this);
 }
 
 void MakeSmartPtrCheck::check(const MatchFinder::MatchResult &Result) {
@@ -55,12 +64,23 @@ void MakeSmartPtrCheck::check(const Matc
   SourceManager &SM = *Result.SourceManager;
   const auto *Construct =
   Result.Nodes.getNodeAs(ConstructorCall);
+  const auto *Reset = Result.Nodes.getNodeAs(ResetCall);
   const auto *Type = Result.Nodes.getNodeAs(PointerType);
   const auto *New = Result.Nodes.getNodeAs(NewExpression);
 
   if (New->getNumPlacementArgs() != 0)
 return;
 
+  if (Construct)
+checkConstruct(SM, Construct, Type, New);
+  else if (Reset)
+checkReset(SM, Reset, New);
+}
+
+void MakeSmartPtrCheck::checkConstruct(SourceManager &SM,
+   const CXXConstructExpr *Construct,
+   const QualType *Type,
+   const CXXNewExpr *New) {
   SourceLocation ConstructCallStart = Construct->getExprLoc();
 
   bool Invalid = false;
@@ -105,6 +125,36 @@ void MakeSmartPtrCheck::check(const Matc
 ")");
   }
 
+  replaceNew(Diag, New);
+}
+
+void MakeSmartPtrCheck::checkReset(SourceManager &SM,
+   const CXXMemberCallExpr *Reset,
+   const CXXNewExpr *New) {
+  const auto *Expr = cast(Reset->getCallee());
+  SourceLocation OperatorLoc = Expr->getOperatorLoc();
+  SourceLocation ResetCallStart = Reset->getExprLoc();
+  SourceLocation ExprStart = Expr->getLocStart();
+  SourceLocation ExprEnd =
+  Lexer::getLocForEndOfToken(Expr->getLocEnd(), 0, SM, getLangOpts());
+
+  auto Diag = diag(ResetCallStart, "use %0 instead")
+  << makeSmartPtrFunctionName;
+
+  Diag << FixItHint::CreateReplacement(
+  CharSourceRange::getCharRange(OperatorLoc, ExprEnd),
+  (llvm::Twine(" = ") + makeSmartPtrFunctionName + "<" +
+   New->getAllocatedType().getAsString(getLangOpts()) + ">")
+  .str());
+
+  if (Expr->isArrow())
+Diag << FixItHint::CreateInsertion(ExprStart, "*");
+
+  replaceNew(Diag, New);
+}
+
+void MakeSmartPtrCheck::replaceNew(DiagnosticBuilder &Diag,
+   const CXXNewExpr *New) {
   SourceLocation NewStart = New->getSourceRange().getBegin()

[PATCH] D25898: [clang-tidy] Enhance modernize-make-unique to handle unique_ptr.reset()

2016-10-31 Thread Malcolm Parsons via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL285589: [clang-tidy] Enhance modernize-make-unique to handle 
unique_ptr.reset() (authored by malcolm.parsons).

Changed prior to commit:
  https://reviews.llvm.org/D25898?vs=76418&id=76419#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25898

Files:
  clang-tools-extra/trunk/clang-tidy/modernize/MakeSmartPtrCheck.cpp
  clang-tools-extra/trunk/clang-tidy/modernize/MakeSmartPtrCheck.h
  clang-tools-extra/trunk/docs/ReleaseNotes.rst
  clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-make-shared.rst
  clang-tools-extra/trunk/docs/clang-tidy/checks/modernize-make-unique.rst
  clang-tools-extra/trunk/test/clang-tidy/modernize-make-shared.cpp
  clang-tools-extra/trunk/test/clang-tidy/modernize-make-unique.cpp

Index: clang-tools-extra/trunk/clang-tidy/modernize/MakeSmartPtrCheck.cpp
===
--- clang-tools-extra/trunk/clang-tidy/modernize/MakeSmartPtrCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/modernize/MakeSmartPtrCheck.cpp
@@ -18,6 +18,7 @@
 
 const char MakeSmartPtrCheck::PointerType[] = "pointerType";
 const char MakeSmartPtrCheck::ConstructorCall[] = "constructorCall";
+const char MakeSmartPtrCheck::ResetCall[] = "resetCall";
 const char MakeSmartPtrCheck::NewExpression[] = "newExpression";
 
 MakeSmartPtrCheck::MakeSmartPtrCheck(StringRef Name, ClangTidyContext *Context,
@@ -31,8 +32,8 @@
 
   // Calling make_smart_ptr from within a member function of a type with a
   // private or protected constructor would be ill-formed.
-  auto CanCallCtor = unless(has(ignoringImpCasts(cxxConstructExpr(
-  hasDeclaration(decl(unless(isPublic(;
+  auto CanCallCtor = unless(has(ignoringImpCasts(
+  cxxConstructExpr(hasDeclaration(decl(unless(isPublic(;
 
   Finder->addMatcher(
   cxxBindTemporaryExpr(has(ignoringParenImpCasts(
@@ -45,6 +46,14 @@
   .bind(NewExpression)))
   .bind(ConstructorCall,
   this);
+
+  Finder->addMatcher(
+  cxxMemberCallExpr(
+  thisPointerType(getSmartPointerTypeMatcher()),
+  callee(cxxMethodDecl(hasName("reset"))),
+  hasArgument(0, cxxNewExpr(CanCallCtor).bind(NewExpression)))
+  .bind(ResetCall),
+  this);
 }
 
 void MakeSmartPtrCheck::check(const MatchFinder::MatchResult &Result) {
@@ -55,12 +64,23 @@
   SourceManager &SM = *Result.SourceManager;
   const auto *Construct =
   Result.Nodes.getNodeAs(ConstructorCall);
+  const auto *Reset = Result.Nodes.getNodeAs(ResetCall);
   const auto *Type = Result.Nodes.getNodeAs(PointerType);
   const auto *New = Result.Nodes.getNodeAs(NewExpression);
 
   if (New->getNumPlacementArgs() != 0)
 return;
 
+  if (Construct)
+checkConstruct(SM, Construct, Type, New);
+  else if (Reset)
+checkReset(SM, Reset, New);
+}
+
+void MakeSmartPtrCheck::checkConstruct(SourceManager &SM,
+   const CXXConstructExpr *Construct,
+   const QualType *Type,
+   const CXXNewExpr *New) {
   SourceLocation ConstructCallStart = Construct->getExprLoc();
 
   bool Invalid = false;
@@ -105,6 +125,36 @@
 ")");
   }
 
+  replaceNew(Diag, New);
+}
+
+void MakeSmartPtrCheck::checkReset(SourceManager &SM,
+   const CXXMemberCallExpr *Reset,
+   const CXXNewExpr *New) {
+  const auto *Expr = cast(Reset->getCallee());
+  SourceLocation OperatorLoc = Expr->getOperatorLoc();
+  SourceLocation ResetCallStart = Reset->getExprLoc();
+  SourceLocation ExprStart = Expr->getLocStart();
+  SourceLocation ExprEnd =
+  Lexer::getLocForEndOfToken(Expr->getLocEnd(), 0, SM, getLangOpts());
+
+  auto Diag = diag(ResetCallStart, "use %0 instead")
+  << makeSmartPtrFunctionName;
+
+  Diag << FixItHint::CreateReplacement(
+  CharSourceRange::getCharRange(OperatorLoc, ExprEnd),
+  (llvm::Twine(" = ") + makeSmartPtrFunctionName + "<" +
+   New->getAllocatedType().getAsString(getLangOpts()) + ">")
+  .str());
+
+  if (Expr->isArrow())
+Diag << FixItHint::CreateInsertion(ExprStart, "*");
+
+  replaceNew(Diag, New);
+}
+
+void MakeSmartPtrCheck::replaceNew(DiagnosticBuilder &Diag,
+   const CXXNewExpr *New) {
   SourceLocation NewStart = New->getSourceRange().getBegin();
   SourceLocation NewEnd = New->getSourceRange().getEnd();
   switch (New->getInitializationStyle()) {
Index: clang-tools-extra/trunk/clang-tidy/modernize/MakeSmartPtrCheck.h
===
--- clang-tools-extra/trunk/clang-tidy/modernize/MakeSmartPtrCheck.h
+++ clang-tools-extra/trunk/clang-tidy/modernize/MakeSmartPtrCheck.h
@@ -39,10 +39,17 @@
 
   static const char PointerType[];
   static const char ConstructorCall[];
+  static const char

[PATCH] D26145: DebugInfo: support for DW_TAG_atomic_type

2016-10-31 Thread Adrian Prantl via cfe-commits
aprantl accepted this revision.
aprantl added a comment.
This revision is now accepted and ready to land.

LGTM with inline comments addressed.




Comment at: test/CodeGen/debug-info-atomic.c:3
+
+// CHECK: !DIDerivedType(tag: DW_TAG_const_type
+// CHECK: !DIDerivedType(tag: DW_TAG_atomic_type

Why do we need the const here?



Comment at: test/CodeGen/debug-info-atomic.c:4
+// CHECK: !DIDerivedType(tag: DW_TAG_const_type
+// CHECK: !DIDerivedType(tag: DW_TAG_atomic_type
+_Atomic const int i;

Can you check that it is actually the DIVariable "i" that has the atomic type?


https://reviews.llvm.org/D26145



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


[PATCH] D26073: [PPC] Add vec_absd functions to altivec.h

2016-10-31 Thread Kit Barton via cfe-commits
kbarton accepted this revision.
kbarton added a comment.
This revision is now accepted and ready to land.

LGTM


https://reviews.llvm.org/D26073



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


[PATCH] D25659: [clang-tidy] Avoid running aliased checks twice

2016-10-31 Thread Malcolm Parsons via cfe-commits
malcolm.parsons added a comment.

ping.


https://reviews.llvm.org/D25659



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


[PATCH] D26138: [clang-tidy] Add modernize-use-delete check

2016-10-31 Thread Alexander Kornienko via cfe-commits
alexfh added a comment.

"Use delete" makes me think of the `delete` operator. I'd suggest one of these 
names:

- modernize-use-equals-delete
- modernize-use-deleted-special-members
- modernize-delete-special-members

(feel free to suggest a better alternative).




Comment at: clang-tidy/modernize/UseDeleteCheck.cpp:37
+  hasParent(cxxRecordDecl(unless(hasMethod(
+  unless(anyOf(PrivateSpecialFn, hasBody(stmt()), isPure(),
+ isDefaulted(), isDeleted(

The double negation makes this part hard to parse. Can you add a comment saying 
(roughly) that the matcher ensures that all non-special functions declared in 
this class are defined in some way in the translation unit we're looking at?


https://reviews.llvm.org/D26138



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


[PATCH] D26138: [clang-tidy] Add modernize-use-delete check

2016-10-31 Thread Malcolm Parsons via cfe-commits
malcolm.parsons added a comment.

In https://reviews.llvm.org/D26138#583561, @alexfh wrote:

> "Use delete" makes me think of the `delete` operator. I'd suggest one of 
> these names:


I chose modernize-use-delete as there's already modernize-use-default.
"Use default" makes me think of the `default` case in a switch.

> - modernize-use-equals-delete

Works for me, but should I rename modernize-use-default?


https://reviews.llvm.org/D26138



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


Re: r285544 - Add support for __builtin_alloca_with_align

2016-10-31 Thread Hal Finkel via cfe-commits
Hi David,

On Reid's patch for this (D25581), Richard said, "This takes the alignment in 
bits? That's so ridiculously dumb that I would feel bad about accepting this 
patch unless it comes with a warning for people writing the obvious-but-wrong 
__builtin_alloca_with_align(sizeof(T), alignof(T))". We should add the warning.

Thanks again,
Hal

- Original Message -
> From: "David Majnemer via cfe-commits" 
> To: cfe-commits@lists.llvm.org
> Sent: Monday, October 31, 2016 12:37:49 AM
> Subject: r285544 - Add support for __builtin_alloca_with_align
> 
> Author: majnemer
> Date: Mon Oct 31 00:37:48 2016
> New Revision: 285544
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=285544&view=rev
> Log:
> Add support for __builtin_alloca_with_align
> 
> __builtin_alloca always uses __BIGGEST_ALIGNMENT__ for the alignment
> of
> the allocation.  __builtin_alloca_with_align allows the programmer to
> specify the alignment of the allocation.
> 
> This fixes PR30658.
> 
> Added:
> cfe/trunk/test/Sema/builtin-alloca-with-align.c
> Modified:
> cfe/trunk/include/clang/Basic/Builtins.def
> cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> cfe/trunk/include/clang/Sema/Sema.h
> cfe/trunk/lib/CodeGen/CGBuiltin.cpp
> cfe/trunk/lib/Sema/SemaChecking.cpp
> cfe/trunk/lib/StaticAnalyzer/Checkers/BuiltinFunctionChecker.cpp
> cfe/trunk/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp
> cfe/trunk/test/CodeGen/builtins-ms.c
> 
> Modified: cfe/trunk/include/clang/Basic/Builtins.def
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Builtins.def?rev=285544&r1=285543&r2=285544&view=diff
> ==
> --- cfe/trunk/include/clang/Basic/Builtins.def (original)
> +++ cfe/trunk/include/clang/Basic/Builtins.def Mon Oct 31 00:37:48
> 2016
> @@ -512,6 +512,7 @@ BUILTIN(__builtin_unreachable, "v", "nr"
>  BUILTIN(__builtin_shufflevector, "v."   , "nc")
>  BUILTIN(__builtin_convertvector, "v."   , "nct")
>  BUILTIN(__builtin_alloca, "v*z"   , "Fn")
> +BUILTIN(__builtin_alloca_with_align, "v*zIz", "Fn")
>  BUILTIN(__builtin_call_with_static_chain, "v.", "nt")
>  
>  // "Overloaded" Atomic operator builtins.  These are overloaded to
>  support data
> 
> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=285544&r1=285543&r2=285544&view=diff
> ==
> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Mon Oct 31
> 00:37:48 2016
> @@ -2440,6 +2440,10 @@ def err_no_accessor_for_property : Error
>  def error_cannot_find_suitable_accessor : Error<
>"cannot find suitable %select{getter|setter}0 for property %1">;
>  
> +def err_alignment_too_small : Error<
> +  "requested alignment must be %0 or greater">;
> +def err_alignment_too_big : Error<
> +  "requested alignment must be %0 or smaller">;
>  def err_alignment_not_power_of_two : Error<
>"requested alignment is not a power of 2">;
>  def err_alignment_dependent_typedef_name : Error<
> 
> Modified: cfe/trunk/include/clang/Sema/Sema.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=285544&r1=285543&r2=285544&view=diff
> ==
> --- cfe/trunk/include/clang/Sema/Sema.h (original)
> +++ cfe/trunk/include/clang/Sema/Sema.h Mon Oct 31 00:37:48 2016
> @@ -9719,6 +9719,7 @@ public:
>  
>  private:
>bool SemaBuiltinPrefetch(CallExpr *TheCall);
> +  bool SemaBuiltinAllocaWithAlign(CallExpr *TheCall);
>bool SemaBuiltinAssume(CallExpr *TheCall);
>bool SemaBuiltinAssumeAligned(CallExpr *TheCall);
>bool SemaBuiltinLongjmp(CallExpr *TheCall);
> 
> Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=285544&r1=285543&r2=285544&view=diff
> ==
> --- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Mon Oct 31 00:37:48 2016
> @@ -1147,6 +1147,19 @@ RValue CodeGenFunction::EmitBuiltinExpr(
>  AI->setAlignment(SuitableAlignmentInBytes);
>  return RValue::get(AI);
>}
> +
> +  case Builtin::BI__builtin_alloca_with_align: {
> +Value *Size = EmitScalarExpr(E->getArg(0));
> +Value *AlignmentValue = EmitScalarExpr(E->getArg(1));
> +auto *AlignmentCI = cast(AlignmentValue);
> +unsigned Alignment = AlignmentCI->getZExtValue();
> +const TargetInfo &TI = getContext().getTargetInfo();
> +unsigned AlignmentInBytes = Alignment / TI.getCharWidth();
> +AllocaInst *AI = Builder.CreateAlloca(Builder.getInt8Ty(),
> Size);
> +AI->setAlignment(AlignmentInBytes);
> +return RValue::g

[PATCH] D25406: Fix doubled whitespace in modernize-use-auto fixit

2016-10-31 Thread Malcolm Parsons via cfe-commits
malcolm.parsons added a comment.

ping @alexfh.


https://reviews.llvm.org/D25406



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


[PATCH] D26141: Protect tests that expect an exception for an unknown std::random_device

2016-10-31 Thread Marshall Clow via cfe-commits
mclow.lists accepted this revision.
mclow.lists added a comment.

LGTM


https://reviews.llvm.org/D26141



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


[PATCH] D25062: [x86][inline-asm][AVX512][llvm][PART-2] Introducing "k" and "Yk" constraints for extended inline assembly, enabling use of AVX512 masked vectorized instructions.

2016-10-31 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL285591: [x86][inline-asm][AVX512][llvm][PART-2] (authored by 
mzuckerm).

Changed prior to commit:
  https://reviews.llvm.org/D25062?vs=75278&id=76429#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25062

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
@@ -32319,6 +32319,7 @@
 case 'Y':
 case 'l':
   return C_RegisterClass;
+case 'k': // AVX512 masking registers.
 case 'a':
 case 'b':
 case 'c':
@@ -32342,6 +32343,19 @@
   break;
 }
   }
+  else if (Constraint.size() == 2) {
+switch (Constraint[0]) {
+default:
+  break;
+case 'Y':
+  switch (Constraint[1]) {
+  default:
+break;
+  case 'k':
+return C_Register;
+  }
+}
+  }
   return TargetLowering::getConstraintType(Constraint);
 }
 
@@ -32385,16 +32399,28 @@
 if (type->isX86_MMXTy() && Subtarget.hasMMX())
   weight = CW_SpecificReg;
 break;
+  case 'Y':
+// Other "Y" (e.g. "Yk") constraints should be implemented below.
+if (constraint[1] == 'k') {
+  // Support for 'Yk' (similarly to the 'k' variant below).
+  weight = CW_SpecificReg;
+  break;
+}
+  // Else fall through (handle "Y" constraint).
+LLVM_FALLTHROUGH;
   case 'v':
 if ((type->getPrimitiveSizeInBits() == 512) && Subtarget.hasAVX512())
   weight = CW_Register;
 LLVM_FALLTHROUGH;
   case 'x':
-  case 'Y':
 if (((type->getPrimitiveSizeInBits() == 128) && Subtarget.hasSSE1()) ||
 ((type->getPrimitiveSizeInBits() == 256) && Subtarget.hasFp256()))
   weight = CW_Register;
 break;
+  case 'k':
+// Enable conditional vector operations using %k<#> registers.
+weight = CW_SpecificReg;
+break;
   case 'I':
 if (ConstantInt *C = dyn_cast(info.CallOperandVal)) {
   if (C->getZExtValue() <= 31)
@@ -32671,6 +32697,24 @@
   // TODO: Slight differences here in allocation order and leaving
   // RIP in the class. Do they matter any more here than they do
   // in the normal allocation?
+case 'k':
+  if (Subtarget.hasAVX512()) {
+//  Only supported in AVX512 or later.
+switch (VT.SimpleTy) {
+default: break;
+case MVT::i32:
+  return std::make_pair(0U, &X86::VK32RegClass);
+case MVT::i16:
+  return std::make_pair(0U, &X86::VK16RegClass);
+case MVT::i8:
+  return std::make_pair(0U, &X86::VK8RegClass);
+case MVT::i1:
+  return std::make_pair(0U, &X86::VK1RegClass);
+case MVT::i64:
+  return std::make_pair(0U, &X86::VK64RegClass);
+}
+  }
+  break;
 case 'q':   // GENERAL_REGS in 64-bit mode, Q_REGS in 32-bit mode.
   if (Subtarget.is64Bit()) {
 if (VT == MVT::i32 || VT == MVT::f32)
@@ -32772,6 +32816,29 @@
   }
   break;
 }
+  } else if (Constraint.size() == 2 && Constraint[0] == 'Y') {
+switch (Constraint[1]) {
+default:
+  break;
+case 'k':
+  // This register class doesn't allocate k0 for masked vector operation.
+  if (Subtarget.hasAVX512()) { // Only supported in AVX512.
+switch (VT.SimpleTy) {
+default: break;
+case MVT::i32:
+  return std::make_pair(0U, &X86::VK32WMRegClass);
+case MVT::i16:
+  return std::make_pair(0U, &X86::VK16WMRegClass);
+case MVT::i8:
+  return std::make_pair(0U, &X86::VK8WMRegClass);
+case MVT::i1:
+  return std::make_pair(0U, &X86::VK1WMRegClass);
+case MVT::i64:
+  return std::make_pair(0U, &X86::VK64WMRegClass);
+} 
+  }
+  break;
+}
   }
 
   // Use the default implementation in TargetLowering to convert the register
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D26138: [clang-tidy] Add modernize-use-delete check

2016-10-31 Thread Malcolm Parsons via cfe-commits
malcolm.parsons updated this revision to Diff 76431.
malcolm.parsons added a comment.

Rename to modernize-use-equals-delete.
Add comment.


https://reviews.llvm.org/D26138

Files:
  clang-tidy/modernize/CMakeLists.txt
  clang-tidy/modernize/ModernizeTidyModule.cpp
  clang-tidy/modernize/UseEqualsDeleteCheck.cpp
  clang-tidy/modernize/UseEqualsDeleteCheck.h
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/modernize-use-equals-delete.rst
  test/clang-tidy/modernize-use-equals-delete.cpp

Index: test/clang-tidy/modernize-use-equals-delete.cpp
===
--- /dev/null
+++ test/clang-tidy/modernize-use-equals-delete.cpp
@@ -0,0 +1,122 @@
+// RUN: %check_clang_tidy %s modernize-use-equals-delete %t
+
+struct PositivePrivate {
+private:
+  PositivePrivate();
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= delete' to prevent a default special member function [modernize-use-equals-delete]
+  // CHECK-FIXES: PositivePrivate() = delete;
+  PositivePrivate(const PositivePrivate &);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= delete' to prevent a default special member function [modernize-use-equals-delete]
+  // CHECK-FIXES: PositivePrivate(const PositivePrivate &) = delete;
+  PositivePrivate &operator=(const PositivePrivate &);
+  // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: use '= delete' to prevent a default special member function [modernize-use-equals-delete]
+  // CHECK-FIXES: PositivePrivate &operator=(const PositivePrivate &) = delete;
+  PositivePrivate(PositivePrivate &&);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= delete' to prevent a default special member function [modernize-use-equals-delete]
+  // CHECK-FIXES: PositivePrivate(PositivePrivate &&) = delete;
+  PositivePrivate &operator=(PositivePrivate &&);
+  // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: use '= delete' to prevent a default special member function [modernize-use-equals-delete]
+  // CHECK-FIXES: PositivePrivate &operator=(PositivePrivate &&) = delete;
+  ~PositivePrivate();
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= delete' to prevent a default special member function [modernize-use-equals-delete]
+  // CHECK-FIXES: ~PositivePrivate() = delete;
+};
+
+struct NegativePublic {
+  NegativePublic(const NegativePublic &);
+};
+
+struct NegativeProtected {
+protected:
+  NegativeProtected(const NegativeProtected &);
+};
+
+struct PositiveInlineMember {
+  int foo() { return 0; }
+
+private:
+  PositiveInlineMember(const PositiveInlineMember &);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= delete' to prevent a default special member function [modernize-use-equals-delete]
+  // CHECK-FIXES: PositiveInlineMember(const PositiveInlineMember &) = delete;
+};
+
+struct PositiveOutOfLineMember {
+  int foo();
+
+private:
+  PositiveOutOfLineMember(const PositiveOutOfLineMember &);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= delete' to prevent a default special member function [modernize-use-equals-delete]
+  // CHECK-FIXES: PositiveOutOfLineMember(const PositiveOutOfLineMember &) = delete;
+};
+
+int PositiveOutOfLineMember::foo() { return 0; }
+
+struct PositiveAbstractMember {
+  virtual int foo() = 0;
+
+private:
+  PositiveAbstractMember(const PositiveAbstractMember &);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= delete' to prevent a default special member function [modernize-use-equals-delete]
+  // CHECK-FIXES: PositiveAbstractMember(const PositiveAbstractMember &) = delete;
+};
+
+struct NegativeMemberNotImpl {
+  int foo();
+
+private:
+  NegativeMemberNotImpl(const NegativeMemberNotImpl &);
+};
+
+struct NegativeStaticMemberNotImpl {
+  static int foo();
+
+private:
+  NegativeStaticMemberNotImpl(const NegativeStaticMemberNotImpl &);
+};
+
+struct NegativeInline {
+private:
+  NegativeInline(const NegativeInline &) {}
+};
+
+struct NegativeOutOfLine {
+private:
+  NegativeOutOfLine(const NegativeOutOfLine &);
+};
+
+NegativeOutOfLine::NegativeOutOfLine(const NegativeOutOfLine &) {}
+
+struct NegativeConstructNotImpl {
+  NegativeConstructNotImpl();
+
+private:
+  NegativeConstructNotImpl(const NegativeConstructNotImpl &);
+};
+
+struct PositiveDefaultedConstruct {
+  PositiveDefaultedConstruct() = default;
+
+private:
+  PositiveDefaultedConstruct(const PositiveDefaultedConstruct &);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= delete' to prevent a default special member function [modernize-use-equals-delete]
+  // CHECK-FIXES: PositiveDefaultedConstruct(const PositiveDefaultedConstruct &) = delete;
+};
+
+struct PositiveDeletedConstruct {
+  PositiveDeletedConstruct() = delete;
+
+private:
+  PositiveDeletedConstruct(const PositiveDeletedConstruct &);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= delete' to prevent a default special member function [modernize-use-equals-delete]
+  // CHECK-FIXES: PositiveDeletedConstruct(const PositiveDeletedConstruct &) = delete;
+};
+

[PATCH] D26138: [clang-tidy] Add modernize-use-delete check

2016-10-31 Thread Malcolm Parsons via cfe-commits
malcolm.parsons updated this revision to Diff 76433.
malcolm.parsons added a comment.

Sort headers and CMakeLists.txt.


https://reviews.llvm.org/D26138

Files:
  clang-tidy/modernize/CMakeLists.txt
  clang-tidy/modernize/ModernizeTidyModule.cpp
  clang-tidy/modernize/UseEqualsDeleteCheck.cpp
  clang-tidy/modernize/UseEqualsDeleteCheck.h
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/modernize-use-equals-delete.rst
  test/clang-tidy/modernize-use-equals-delete.cpp

Index: test/clang-tidy/modernize-use-equals-delete.cpp
===
--- /dev/null
+++ test/clang-tidy/modernize-use-equals-delete.cpp
@@ -0,0 +1,122 @@
+// RUN: %check_clang_tidy %s modernize-use-equals-delete %t
+
+struct PositivePrivate {
+private:
+  PositivePrivate();
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= delete' to prevent a default special member function [modernize-use-equals-delete]
+  // CHECK-FIXES: PositivePrivate() = delete;
+  PositivePrivate(const PositivePrivate &);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= delete' to prevent a default special member function [modernize-use-equals-delete]
+  // CHECK-FIXES: PositivePrivate(const PositivePrivate &) = delete;
+  PositivePrivate &operator=(const PositivePrivate &);
+  // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: use '= delete' to prevent a default special member function [modernize-use-equals-delete]
+  // CHECK-FIXES: PositivePrivate &operator=(const PositivePrivate &) = delete;
+  PositivePrivate(PositivePrivate &&);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= delete' to prevent a default special member function [modernize-use-equals-delete]
+  // CHECK-FIXES: PositivePrivate(PositivePrivate &&) = delete;
+  PositivePrivate &operator=(PositivePrivate &&);
+  // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: use '= delete' to prevent a default special member function [modernize-use-equals-delete]
+  // CHECK-FIXES: PositivePrivate &operator=(PositivePrivate &&) = delete;
+  ~PositivePrivate();
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= delete' to prevent a default special member function [modernize-use-equals-delete]
+  // CHECK-FIXES: ~PositivePrivate() = delete;
+};
+
+struct NegativePublic {
+  NegativePublic(const NegativePublic &);
+};
+
+struct NegativeProtected {
+protected:
+  NegativeProtected(const NegativeProtected &);
+};
+
+struct PositiveInlineMember {
+  int foo() { return 0; }
+
+private:
+  PositiveInlineMember(const PositiveInlineMember &);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= delete' to prevent a default special member function [modernize-use-equals-delete]
+  // CHECK-FIXES: PositiveInlineMember(const PositiveInlineMember &) = delete;
+};
+
+struct PositiveOutOfLineMember {
+  int foo();
+
+private:
+  PositiveOutOfLineMember(const PositiveOutOfLineMember &);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= delete' to prevent a default special member function [modernize-use-equals-delete]
+  // CHECK-FIXES: PositiveOutOfLineMember(const PositiveOutOfLineMember &) = delete;
+};
+
+int PositiveOutOfLineMember::foo() { return 0; }
+
+struct PositiveAbstractMember {
+  virtual int foo() = 0;
+
+private:
+  PositiveAbstractMember(const PositiveAbstractMember &);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= delete' to prevent a default special member function [modernize-use-equals-delete]
+  // CHECK-FIXES: PositiveAbstractMember(const PositiveAbstractMember &) = delete;
+};
+
+struct NegativeMemberNotImpl {
+  int foo();
+
+private:
+  NegativeMemberNotImpl(const NegativeMemberNotImpl &);
+};
+
+struct NegativeStaticMemberNotImpl {
+  static int foo();
+
+private:
+  NegativeStaticMemberNotImpl(const NegativeStaticMemberNotImpl &);
+};
+
+struct NegativeInline {
+private:
+  NegativeInline(const NegativeInline &) {}
+};
+
+struct NegativeOutOfLine {
+private:
+  NegativeOutOfLine(const NegativeOutOfLine &);
+};
+
+NegativeOutOfLine::NegativeOutOfLine(const NegativeOutOfLine &) {}
+
+struct NegativeConstructNotImpl {
+  NegativeConstructNotImpl();
+
+private:
+  NegativeConstructNotImpl(const NegativeConstructNotImpl &);
+};
+
+struct PositiveDefaultedConstruct {
+  PositiveDefaultedConstruct() = default;
+
+private:
+  PositiveDefaultedConstruct(const PositiveDefaultedConstruct &);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= delete' to prevent a default special member function [modernize-use-equals-delete]
+  // CHECK-FIXES: PositiveDefaultedConstruct(const PositiveDefaultedConstruct &) = delete;
+};
+
+struct PositiveDeletedConstruct {
+  PositiveDeletedConstruct() = delete;
+
+private:
+  PositiveDeletedConstruct(const PositiveDeletedConstruct &);
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use '= delete' to prevent a default special member function [modernize-use-equals-delete]
+  // CHECK-FIXES: PositiveDeletedConstruct(const PositiveDeletedConstruct &) = delete;
+};
+
+struct NegativeDe

[PATCH] D25316: [clang-tidy] Enhance modernize-use-auto to casts

2016-10-31 Thread Aaron Ballman via cfe-commits
aaron.ballman added a comment.

Does this check properly work in the presence of macros? Those are sometimes 
more common in casting operations, so a few explicit tests would be good (those 
tests could be follow-on work if it turns out that this check doesn't play 
nicely with macros).




Comment at: clang-tidy/modernize/UseAutoCheck.cpp:404
+[](const Expr *Expr) { return Expr->getType(); },
+"use auto when initializing with new to avoid "
+"duplicating the type name");

Quote use of `auto` and `new` in the diagnostic since they're syntax rather 
than english.



Comment at: clang-tidy/modernize/UseAutoCheck.cpp:413
+},
+"use auto when initializing with a cast to avoid duplicating the type "
+"name");

Same here.


Repository:
  rL LLVM

https://reviews.llvm.org/D25316



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


r285595 - Use toCharUnitsFromBits instead of TargetInfo::getCharWidth

2016-10-31 Thread David Majnemer via cfe-commits
Author: majnemer
Date: Mon Oct 31 11:48:30 2016
New Revision: 285595

URL: http://llvm.org/viewvc/llvm-project?rev=285595&view=rev
Log:
Use toCharUnitsFromBits instead of TargetInfo::getCharWidth

Modified:
cfe/trunk/lib/CodeGen/CGBuiltin.cpp

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=285595&r1=285594&r2=285595&view=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Mon Oct 31 11:48:30 2016
@@ -1142,7 +1142,9 @@ RValue CodeGenFunction::EmitBuiltinExpr(
 const TargetInfo &TI = getContext().getTargetInfo();
 // The alignment of the alloca should correspond to __BIGGEST_ALIGNMENT__.
 unsigned SuitableAlignmentInBytes =
-TI.getSuitableAlign() / TI.getCharWidth();
+CGM.getContext()
+.toCharUnitsFromBits(TI.getSuitableAlign())
+.getQuantity();
 AllocaInst *AI = Builder.CreateAlloca(Builder.getInt8Ty(), Size);
 AI->setAlignment(SuitableAlignmentInBytes);
 return RValue::get(AI);
@@ -1150,11 +1152,11 @@ RValue CodeGenFunction::EmitBuiltinExpr(
 
   case Builtin::BI__builtin_alloca_with_align: {
 Value *Size = EmitScalarExpr(E->getArg(0));
-Value *AlignmentValue = EmitScalarExpr(E->getArg(1));
-auto *AlignmentCI = cast(AlignmentValue);
-unsigned Alignment = AlignmentCI->getZExtValue();
-const TargetInfo &TI = getContext().getTargetInfo();
-unsigned AlignmentInBytes = Alignment / TI.getCharWidth();
+Value *AlignmentInBitsValue = EmitScalarExpr(E->getArg(1));
+auto *AlignmentInBitsCI = cast(AlignmentInBitsValue);
+unsigned AlignmentInBits = AlignmentInBitsCI->getZExtValue();
+unsigned AlignmentInBytes =
+CGM.getContext().toCharUnitsFromBits(AlignmentInBits).getQuantity();
 AllocaInst *AI = Builder.CreateAlloca(Builder.getInt8Ty(), Size);
 AI->setAlignment(AlignmentInBytes);
 return RValue::get(AI);


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


[PATCH] D26032: [ASTMatcher] Add CXXNewExpr support to hasDeclaration

2016-10-31 Thread Łukasz Anforowicz via cfe-commits
lukasza added a comment.

FWIW, a non-owner LGTM:

- CXXNewExpr seems very similar to CallExpr, so it makes sense that 
hasDeclaration would behave similarily for both of these expressions (i.e. 
matching the "callee")
- The issues we've been trying to work through in 
https://reviews.llvm.org/D24361 mainly revolve around Type and QualType, so I 
think those issues should not apply to CXXNewExpr matching.


https://reviews.llvm.org/D26032



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


[PATCH] D26145: DebugInfo: support for DW_TAG_atomic_type

2016-10-31 Thread Victor Leschuk via cfe-commits
vleschuk added inline comments.



Comment at: test/CodeGen/debug-info-atomic.c:3
+
+// CHECK: !DIDerivedType(tag: DW_TAG_const_type
+// CHECK: !DIDerivedType(tag: DW_TAG_atomic_type

aprantl wrote:
> Why do we need the const here?
I thought it would be better to make sure that "enabling" atomic doesn't affect 
other qualifiers.


https://reviews.llvm.org/D26145



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


[PATCH] D25316: [clang-tidy] Enhance modernize-use-auto to casts

2016-10-31 Thread Malcolm Parsons via cfe-commits
malcolm.parsons added inline comments.



Comment at: clang-tidy/modernize/UseAutoCheck.cpp:404
+[](const Expr *Expr) { return Expr->getType(); },
+"use auto when initializing with new to avoid "
+"duplicating the type name");

aaron.ballman wrote:
> Quote use of `auto` and `new` in the diagnostic since they're syntax rather 
> than english.
A lot of clang-tidy diagnostics don't quote syntax/functions/types:

```
"do not use reinterpret_cast"
"pass by value and use std::move"
"use nullptr"
"the shrink_to_fit method should be used "
"use std::move to transfer ownership"
"auto_ptr is deprecated, use unique_ptr instead"
"use auto when declaring iterators"
"use range-based for loop instead"
"use emplace_back instead of push_back"
"prefer a lambda to std::bind"
...
```


Repository:
  rL LLVM

https://reviews.llvm.org/D25316



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


[PATCH] D26145: DebugInfo: support for DW_TAG_atomic_type

2016-10-31 Thread Victor Leschuk via cfe-commits
vleschuk updated this revision to Diff 76441.
vleschuk added a comment.

Made test more strict: it now checks that variable i is atomic.


https://reviews.llvm.org/D26145

Files:
  lib/CodeGen/CGDebugInfo.cpp
  test/CodeGen/debug-info-atomic.c


Index: test/CodeGen/debug-info-atomic.c
===
--- /dev/null
+++ test/CodeGen/debug-info-atomic.c
@@ -0,0 +1,7 @@
+// RUN: %clang -g -c -std=c11 -S -emit-llvm -o - %s | FileCheck %s
+
+// CHECK: !DIGlobalVariable(name: "i"{{.*}}type: !5, isLocal: false, 
isDefinition: true)
+// CHECK: !5 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !6)
+// CHECK: !6 = !DIDerivedType(tag: DW_TAG_atomic_type, baseType: !7)
+// CHECK: !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
+_Atomic const int i;
Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -2287,9 +2287,8 @@
 }
 
 llvm::DIType *CGDebugInfo::CreateType(const AtomicType *Ty, llvm::DIFile *U) {
-  // Ignore the atomic wrapping
-  // FIXME: What is the correct representation?
-  return getOrCreateType(Ty->getValueType(), U);
+  auto *FromTy = getOrCreateType(Ty->getValueType(), U);
+  return DBuilder.createQualifiedType(llvm::dwarf::DW_TAG_atomic_type, FromTy);
 }
 
 llvm::DIType* CGDebugInfo::CreateType(const PipeType *Ty,


Index: test/CodeGen/debug-info-atomic.c
===
--- /dev/null
+++ test/CodeGen/debug-info-atomic.c
@@ -0,0 +1,7 @@
+// RUN: %clang -g -c -std=c11 -S -emit-llvm -o - %s | FileCheck %s
+
+// CHECK: !DIGlobalVariable(name: "i"{{.*}}type: !5, isLocal: false, isDefinition: true)
+// CHECK: !5 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !6)
+// CHECK: !6 = !DIDerivedType(tag: DW_TAG_atomic_type, baseType: !7)
+// CHECK: !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
+_Atomic const int i;
Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -2287,9 +2287,8 @@
 }
 
 llvm::DIType *CGDebugInfo::CreateType(const AtomicType *Ty, llvm::DIFile *U) {
-  // Ignore the atomic wrapping
-  // FIXME: What is the correct representation?
-  return getOrCreateType(Ty->getValueType(), U);
+  auto *FromTy = getOrCreateType(Ty->getValueType(), U);
+  return DBuilder.createQualifiedType(llvm::dwarf::DW_TAG_atomic_type, FromTy);
 }
 
 llvm::DIType* CGDebugInfo::CreateType(const PipeType *Ty,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r285601 - Add modernize-use-auto tests for casts inside macros

2016-10-31 Thread Malcolm Parsons via cfe-commits
Author: malcolm.parsons
Date: Mon Oct 31 12:17:45 2016
New Revision: 285601

URL: http://llvm.org/viewvc/llvm-project?rev=285601&view=rev
Log:
Add modernize-use-auto tests for casts inside macros

Modified:

clang-tools-extra/trunk/test/clang-tidy/modernize-use-auto-cast-remove-stars.cpp
clang-tools-extra/trunk/test/clang-tidy/modernize-use-auto-cast.cpp

Modified: 
clang-tools-extra/trunk/test/clang-tidy/modernize-use-auto-cast-remove-stars.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/modernize-use-auto-cast-remove-stars.cpp?rev=285601&r1=285600&r2=285601&view=diff
==
--- 
clang-tools-extra/trunk/test/clang-tidy/modernize-use-auto-cast-remove-stars.cpp
 (original)
+++ 
clang-tools-extra/trunk/test/clang-tidy/modernize-use-auto-cast-remove-stars.cpp
 Mon Oct 31 12:17:45 2016
@@ -96,6 +96,17 @@ void f_const_cast() {
   // CHECK-FIXES: auto  &a3 = const_cast(*a1);
 }
 
+typedef unsigned char xmlChar;
+#define BAD_CAST (xmlChar *)
+
+#define XMLCHAR_CAST(x) (xmlChar *)(x)
+
+#define CAST_IN_MACRO(x) \
+  do {   \
+xmlChar *s = (xmlChar *)(x); \
+  } while (false);
+// CHECK-FIXES: xmlChar *s = (xmlChar *)(x);
+
 void f_cstyle_cast() {
   auto *a = new A();
   C *c1 = (C *)a;
@@ -105,6 +116,15 @@ void f_cstyle_cast() {
   C &c2 = (C &)*a;
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with 
a cast to avoid duplicating the type name
   // CHECK-FIXES: auto  &c2 = (C &)*a;
+
+  xmlChar  *s = BAD_CAST "xml";
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with 
a cast to avoid duplicating the type name
+  // CHECK-FIXES: auto s = BAD_CAST "xml";
+  xmlChar  *t = XMLCHAR_CAST("xml");
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with 
a cast to avoid duplicating the type name
+  // CHECK-FIXES: auto t = XMLCHAR_CAST("xml");
+  CAST_IN_MACRO("xml");
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with 
a cast to avoid duplicating the type name
 }
 
 void f_functional_cast() {

Modified: clang-tools-extra/trunk/test/clang-tidy/modernize-use-auto-cast.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/modernize-use-auto-cast.cpp?rev=285601&r1=285600&r2=285601&view=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/modernize-use-auto-cast.cpp 
(original)
+++ clang-tools-extra/trunk/test/clang-tidy/modernize-use-auto-cast.cpp Mon Oct 
31 12:17:45 2016
@@ -98,6 +98,17 @@ void f_const_cast() {
   // CHECK-FIXES: auto &a3 = const_cast(*a1);
 }
 
+typedef unsigned char xmlChar;
+#define BAD_CAST (xmlChar *)
+
+#define XMLCHAR_CAST(x) (xmlChar *)(x)
+
+#define CAST_IN_MACRO(x) \
+  do {   \
+xmlChar *s = (xmlChar *)(x); \
+  } while (false);
+// CHECK-FIXES: xmlChar *s = (xmlChar *)(x);
+
 void f_cstyle_cast() {
   auto *a = new A();
   C *c1 = (C *)a;
@@ -107,6 +118,15 @@ void f_cstyle_cast() {
   C &c2 = (C &)*a;
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with 
a cast to avoid duplicating the type name
   // CHECK-FIXES: auto &c2 = (C &)*a;
+
+  xmlChar *s = BAD_CAST "xml";
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with 
a cast to avoid duplicating the type name
+  // CHECK-FIXES: auto *s = BAD_CAST "xml";
+  xmlChar *t = XMLCHAR_CAST("xml");
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with 
a cast to avoid duplicating the type name
+  // CHECK-FIXES: auto *t = XMLCHAR_CAST("xml");
+  CAST_IN_MACRO("xml");
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when initializing with 
a cast to avoid duplicating the type name
 }
 
 void f_functional_cast() {


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


[PATCH] D25343: [OpenCL] Mark group functions as convergent in opencl-c.h

2016-10-31 Thread Anastasia Stulova via cfe-commits
Anastasia accepted this revision.
Anastasia added a comment.

LGTM! Thanks! Could you please address the last comment before committing?




Comment at: test/CodeGenOpenCL/convergent.cl:54
+// CHECK: tail call spir_func void @f()
+// CHECK-NOT: call spir_func void @non_convfun()
+// CHECK-NOT: call spir_func void @g()

Did you mean to check @convfun() here?


https://reviews.llvm.org/D25343



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


r285604 - [x86][inline-asm][AVX512][clang][PART-1] Introducing "k" and "Yk" constraints for extended inline assembly, enabling use of AVX512 masked vectorized instructions.

2016-10-31 Thread Michael Zuckerman via cfe-commits
Author: mzuckerm
Date: Mon Oct 31 12:23:52 2016
New Revision: 285604

URL: http://llvm.org/viewvc/llvm-project?rev=285604&view=rev
Log:
[x86][inline-asm][AVX512][clang][PART-1] Introducing "k" and "Yk" constraints 
for extended inline assembly, enabling use of AVX512 masked vectorized 
instructions.

Commit on behalf of mharoush

Extending inline assembly support, compatible with GCC as folowing:
 "k" constraint hints the compiler to select any of AVX512 k0-k7 registers.
 "Yk" constraint is a subset of "k" excluding k0 which is not allowd to be used 
as a mask.

Reviewer: 1. rnk

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


Added:
cfe/trunk/test/CodeGen/avx512-kconstraints-att_inline_asm.c
Modified:
cfe/trunk/lib/Basic/Targets.cpp

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=285604&r1=285603&r2=285604&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Mon Oct 31 12:23:52 2016
@@ -3997,6 +3997,7 @@ X86TargetInfo::validateAsmConstraint(con
 case 't': // Any SSE register, when SSE2 is enabled.
 case 'i': // Any SSE register, when SSE2 and inter-unit moves enabled.
 case 'm': // Any MMX register, when inter-unit moves enabled.
+case 'k': // AVX512 arch mask registers: k1-k7.
   Info.setAllowsRegister();
   return true;
 }
@@ -4018,6 +4019,8 @@ X86TargetInfo::validateAsmConstraint(con
   case 'q': // Any register accessible as [r]l: a, b, c, and d.
   case 'y': // Any MMX register.
   case 'x': // Any SSE register.
+  case 'k': // Any AVX512 mask register (same as Yk, additionaly allows k0
+// for intermideate k reg operations).
   case 'Q': // Any register accessible as [r]h: a, b, c, and d.
   case 'R': // "Legacy" registers: ax, bx, cx, dx, di, si, sp, bp.
   case 'l': // "Index" registers: any general register that can be used as an
@@ -4051,6 +4054,8 @@ bool X86TargetInfo::validateOperandSize(
 unsigned Size) const {
   switch (Constraint[0]) {
   default: break;
+  case 'k':
+  // Registers k0-k7 (AVX512) size limit is 64 bit.
   case 'y':
 return Size <= 64;
   case 'f':
@@ -4071,6 +4076,7 @@ bool X86TargetInfo::validateOperandSize(
 default: break;
 case 'm':
   // 'Ym' is synonymous with 'y'.
+case 'k':
   return Size <= 64;
 case 'i':
 case 't':
@@ -4102,6 +4108,20 @@ X86TargetInfo::convertConstraint(const c
 return std::string("{st}");
   case 'u': // second from top of floating point stack.
 return std::string("{st(1)}"); // second from top of floating point stack.
+  case 'Y':
+switch (Constraint[1]) {
+default:
+  // Break from inner switch and fall through (copy single char),
+  // continue parsing after copying the current constraint into 
+  // the return string.
+  break;
+case 'k':
+  // "^" hints llvm that this is a 2 letter constraint.
+  // "Constraint++" is used to promote the string iterator 
+  // to the next constraint.
+  return std::string("^") + std::string(Constraint++, 2);
+} 
+LLVM_FALLTHROUGH;
   default:
 return std::string(1, *Constraint);
   }

Added: cfe/trunk/test/CodeGen/avx512-kconstraints-att_inline_asm.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512-kconstraints-att_inline_asm.c?rev=285604&view=auto
==
--- cfe/trunk/test/CodeGen/avx512-kconstraints-att_inline_asm.c (added)
+++ cfe/trunk/test/CodeGen/avx512-kconstraints-att_inline_asm.c Mon Oct 31 
12:23:52 2016
@@ -0,0 +1,59 @@
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -target-cpu skylake-avx512 
-O0  -emit-llvm -S -o - -Wall -Werror | FileCheck %s
+// This test checks validity of att\gcc style inline assmebly for avx512 k and 
Yk constraints.
+// Also checks mask register allows flexible type (size <= 64 bit)
+
+void mask_Yk_i8(char msk){ 
+//CHECK: vpaddb %xmm1, %xmm0, %xmm1 {%k1}
+ asm ("vpaddb\t %%xmm1, %%xmm0, %%xmm1 %{%0%}\t"
+   ://output
+   : "Yk" (msk));   //inputs
+}
+
+void mask_Yk_i16(short msk){
+//CHECK: vpaddb %xmm1, %xmm0, %xmm1 {%k1}
+ asm ("vpaddb\t %%xmm1, %%xmm0, %%xmm1 %{%0%}\t"
+   ://output
+   :  "Yk" (msk));  //inputs
+}
+
+void mask_Yk_i32(int msk){
+//CHECK: vpaddb %xmm1, %xmm0, %xmm1 {%k1}
+asm ("vpaddb\t %%xmm1, %%xmm0, %%xmm1 %{%0%}\t"
+   ://output
+   :  "Yk" (msk));   //inputs
+}
+
+void mask_Yk_i64(long long msk){
+//CHECK: vpaddb %xmm1, %xmm0, %xmm1 {%k1}
+ asm ("vpaddb\t %%xmm1, %%xmm0, %%xmm1 %{%0%}\t"
+   ://output
+   :  "Yk" (msk));   //inputs
+}
+
+void k_wise_op_i8(char msk_dst,char msk_src1,char msk_src2){
+//CHECK: kandw %k1, %k0, %k0
+ asm ("kandw\t%2, %1, %0"
+   : "=k" (msk_ds

[PATCH] D25343: [OpenCL] Mark group functions as convergent in opencl-c.h

2016-10-31 Thread Anastasia Stulova via cfe-commits
Anastasia added a comment.

Additional discussions: 
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20161024/175373.html


https://reviews.llvm.org/D25343



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


[PATCH] D25935: [OpenCL] Diagnose variadic arguments

2016-10-31 Thread Anastasia Stulova via cfe-commits
Anastasia closed this revision.
Anastasia added a comment.

Committed in r285395


https://reviews.llvm.org/D25935



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


[PATCH] D25063: [x86][inline-asm][AVX512][clang][PART-1] Introducing "k" and "Yk" constraints for extended inline assembly, enabling use of AVX512 masked vectorized instructions.

2016-10-31 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL285604: [x86][inline-asm][AVX512][clang][PART-1] Introducing 
"k" and "Yk" constraints… (authored by mzuckerm).

Changed prior to commit:
  https://reviews.llvm.org/D25063?vs=75542&id=76445#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25063

Files:
  cfe/trunk/lib/Basic/Targets.cpp
  cfe/trunk/test/CodeGen/avx512-kconstraints-att_inline_asm.c

Index: cfe/trunk/test/CodeGen/avx512-kconstraints-att_inline_asm.c
===
--- cfe/trunk/test/CodeGen/avx512-kconstraints-att_inline_asm.c
+++ cfe/trunk/test/CodeGen/avx512-kconstraints-att_inline_asm.c
@@ -0,0 +1,59 @@
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -target-cpu skylake-avx512 -O0  -emit-llvm -S -o - -Wall -Werror | FileCheck %s
+// This test checks validity of att\gcc style inline assmebly for avx512 k and Yk constraints.
+// Also checks mask register allows flexible type (size <= 64 bit)
+
+void mask_Yk_i8(char msk){ 
+//CHECK: vpaddb %xmm1, %xmm0, %xmm1 {%k1}
+ asm ("vpaddb\t %%xmm1, %%xmm0, %%xmm1 %{%0%}\t"
+   ://output
+   : "Yk" (msk));   //inputs
+}
+
+void mask_Yk_i16(short msk){
+//CHECK: vpaddb %xmm1, %xmm0, %xmm1 {%k1}
+ asm ("vpaddb\t %%xmm1, %%xmm0, %%xmm1 %{%0%}\t"
+   ://output
+   :  "Yk" (msk));  //inputs
+}
+
+void mask_Yk_i32(int msk){
+//CHECK: vpaddb %xmm1, %xmm0, %xmm1 {%k1}
+asm ("vpaddb\t %%xmm1, %%xmm0, %%xmm1 %{%0%}\t"
+   ://output
+   :  "Yk" (msk));   //inputs
+}
+
+void mask_Yk_i64(long long msk){
+//CHECK: vpaddb %xmm1, %xmm0, %xmm1 {%k1}
+ asm ("vpaddb\t %%xmm1, %%xmm0, %%xmm1 %{%0%}\t"
+   ://output
+   :  "Yk" (msk));   //inputs
+}
+
+void k_wise_op_i8(char msk_dst,char msk_src1,char msk_src2){
+//CHECK: kandw %k1, %k0, %k0
+ asm ("kandw\t%2, %1, %0"
+   : "=k" (msk_dst)
+   : "k" (msk_src1), "k" (msk_src2));
+}
+
+void k_wise_op_i16(short msk_dst, short msk_src1, short msk_src2){
+//CHECK: kandw %k1, %k0, %k0
+  asm ("kandw\t%2, %1, %0"
+   : "=k" (msk_dst)
+   : "k" (msk_src1), "k" (msk_src2));
+}
+
+void k_wise_op_i32(int msk_dst, int msk_src1, int msk_src2){
+//CHECK: kandw %k1, %k0, %k0
+  asm ("kandw\t%2, %1, %0"
+   : "=k" (msk_dst)
+   : "k" (msk_src1), "k" (msk_src2));
+}
+
+void k_wise_op_i64(long long msk_dst, long long msk_src1, long long msk_src2){
+//CHECK: kandw %k1, %k0, %k0
+  asm ("kandw\t%2, %1, %0"
+   : "=k" (msk_dst)
+   : "k" (msk_src1), "k" (msk_src2));
+}
Index: cfe/trunk/lib/Basic/Targets.cpp
===
--- cfe/trunk/lib/Basic/Targets.cpp
+++ cfe/trunk/lib/Basic/Targets.cpp
@@ -3997,6 +3997,7 @@
 case 't': // Any SSE register, when SSE2 is enabled.
 case 'i': // Any SSE register, when SSE2 and inter-unit moves enabled.
 case 'm': // Any MMX register, when inter-unit moves enabled.
+case 'k': // AVX512 arch mask registers: k1-k7.
   Info.setAllowsRegister();
   return true;
 }
@@ -4018,6 +4019,8 @@
   case 'q': // Any register accessible as [r]l: a, b, c, and d.
   case 'y': // Any MMX register.
   case 'x': // Any SSE register.
+  case 'k': // Any AVX512 mask register (same as Yk, additionaly allows k0
+// for intermideate k reg operations).
   case 'Q': // Any register accessible as [r]h: a, b, c, and d.
   case 'R': // "Legacy" registers: ax, bx, cx, dx, di, si, sp, bp.
   case 'l': // "Index" registers: any general register that can be used as an
@@ -4051,6 +4054,8 @@
 unsigned Size) const {
   switch (Constraint[0]) {
   default: break;
+  case 'k':
+  // Registers k0-k7 (AVX512) size limit is 64 bit.
   case 'y':
 return Size <= 64;
   case 'f':
@@ -4071,6 +4076,7 @@
 default: break;
 case 'm':
   // 'Ym' is synonymous with 'y'.
+case 'k':
   return Size <= 64;
 case 'i':
 case 't':
@@ -4102,6 +4108,20 @@
 return std::string("{st}");
   case 'u': // second from top of floating point stack.
 return std::string("{st(1)}"); // second from top of floating point stack.
+  case 'Y':
+switch (Constraint[1]) {
+default:
+  // Break from inner switch and fall through (copy single char),
+  // continue parsing after copying the current constraint into 
+  // the return string.
+  break;
+case 'k':
+  // "^" hints llvm that this is a 2 letter constraint.
+  // "Constraint++" is used to promote the string iterator 
+  // to the next constraint.
+  return std::string("^") + std::string(Constraint++, 2);
+} 
+LLVM_FALLTHROUGH;
   default:
 return std::string(1, *Constraint);
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r285605 - [analyzer] MacOSXAPIChecker: Disallow dispatch_once_t in ivars and heap.

2016-10-31 Thread Artem Dergachev via cfe-commits
Author: dergachev
Date: Mon Oct 31 12:27:26 2016
New Revision: 285605

URL: http://llvm.org/viewvc/llvm-project?rev=285605&view=rev
Log:
[analyzer] MacOSXAPIChecker: Disallow dispatch_once_t in ivars and heap.

Unlike global/static variables, calloc etc. functions that allocate ObjC
objects behave differently in terms of memory barriers, and hacks that make
dispatch_once as fast as it possibly could be start failing.

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

Added:
cfe/trunk/test/Analysis/dispatch-once.m
Modified:
cfe/trunk/lib/StaticAnalyzer/Checkers/MacOSXAPIChecker.cpp
cfe/trunk/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/MacOSXAPIChecker.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/MacOSXAPIChecker.cpp?rev=285605&r1=285604&r2=285605&view=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Checkers/MacOSXAPIChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/MacOSXAPIChecker.cpp Mon Oct 31 
12:27:26 2016
@@ -33,6 +33,8 @@ namespace {
 class MacOSXAPIChecker : public Checker< check::PreStmt > {
   mutable std::unique_ptr BT_dispatchOnce;
 
+  static const ObjCIvarRegion *getParentIvarRegion(const MemRegion *R);
+
 public:
   void checkPreStmt(const CallExpr *CE, CheckerContext &C) const;
 
@@ -49,27 +51,34 @@ public:
 // dispatch_once and dispatch_once_f
 
//===--===//
 
+const ObjCIvarRegion *
+MacOSXAPIChecker::getParentIvarRegion(const MemRegion *R) {
+  const SubRegion *SR = dyn_cast(R);
+  while (SR) {
+if (const ObjCIvarRegion *IR = dyn_cast(SR))
+  return IR;
+SR = dyn_cast(SR->getSuperRegion());
+  }
+  return nullptr;
+}
+
 void MacOSXAPIChecker::CheckDispatchOnce(CheckerContext &C, const CallExpr *CE,
  StringRef FName) const {
   if (CE->getNumArgs() < 1)
 return;
 
-  // Check if the first argument is stack allocated.  If so, issue a warning
-  // because that's likely to be bad news.
-  ProgramStateRef state = C.getState();
-  const MemRegion *R =
-state->getSVal(CE->getArg(0), C.getLocationContext()).getAsRegion();
-  if (!R || !isa(R->getMemorySpace()))
+  // Check if the first argument is improperly allocated.  If so, issue a
+  // warning because that's likely to be bad news.
+  const MemRegion *R = C.getSVal(CE->getArg(0)).getAsRegion();
+  if (!R)
 return;
 
-  ExplodedNode *N = C.generateErrorNode(state);
-  if (!N)
+  // Global variables are fine.
+  const MemRegion *RB = R->getBaseRegion();
+  const MemSpaceRegion *RS = RB->getMemorySpace();
+  if (isa(RS))
 return;
 
-  if (!BT_dispatchOnce)
-BT_dispatchOnce.reset(new BugType(this, "Improper use of 'dispatch_once'",
-  "API Misuse (Apple)"));
-
   // Handle _dispatch_once.  In some versions of the OS X SDK we have the case
   // that dispatch_once is a macro that wraps a call to _dispatch_once.
   // _dispatch_once is then a function which then calls the real dispatch_once.
@@ -82,16 +91,40 @@ void MacOSXAPIChecker::CheckDispatchOnce
 
   SmallString<256> S;
   llvm::raw_svector_ostream os(S);
+  bool SuggestStatic = false;
   os << "Call to '" << FName << "' uses";
-  if (const VarRegion *VR = dyn_cast(R))
+  if (const VarRegion *VR = dyn_cast(RB)) {
+// We filtered out globals earlier, so it must be a local variable.
+if (VR != R)
+  os << " memory within";
 os << " the local variable '" << VR->getDecl()->getName() << '\'';
-  else
+SuggestStatic = true;
+  } else if (const ObjCIvarRegion *IVR = getParentIvarRegion(R)) {
+if (IVR != R)
+  os << " memory within";
+os << " the instance variable '" << IVR->getDecl()->getName() << '\'';
+  } else if (isa(RS)) {
+os << " heap-allocated memory";
+  } else if (isa(RS)) {
+// Presence of an IVar superregion has priority over this branch, because
+// ObjC objects are on the heap even if the core doesn't realize this.
+return;
+  } else {
 os << " stack allocated memory";
+  }
   os << " for the predicate value.  Using such transient memory for "
 "the predicate is potentially dangerous.";
-  if (isa(R) && isa(R->getMemorySpace()))
+  if (SuggestStatic)
 os << "  Perhaps you intended to declare the variable as 'static'?";
 
+  ExplodedNode *N = C.generateErrorNode();
+  if (!N)
+return;
+
+  if (!BT_dispatchOnce)
+BT_dispatchOnce.reset(new BugType(this, "Improper use of 'dispatch_once'",
+  "API Misuse (Apple)"));
+
   auto report = llvm::make_unique(*BT_dispatchOnce, os.str(), N);
   report->addRange(CE->getArg(0)->getSourceRange());
   C.emitReport(std::move(report));

Modified: cfe/trunk/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/SimpleSVa

  1   2   >