[PATCH] D69632: [libTooling] Add Stencil constructor.

2019-11-01 Thread Yitzhak Mandelbaum via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6e759daf2ea8: [libTooling] Add Stencil constructor. 
(authored by ymandel).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69632/new/

https://reviews.llvm.org/D69632

Files:
  clang/include/clang/Tooling/Transformer/Stencil.h


Index: clang/include/clang/Tooling/Transformer/Stencil.h
===
--- clang/include/clang/Tooling/Transformer/Stencil.h
+++ clang/include/clang/Tooling/Transformer/Stencil.h
@@ -90,6 +90,7 @@
 class Stencil {
 public:
   Stencil() = default;
+  Stencil(std::vector Parts) : Parts(std::move(Parts)) {}
 
   /// Composes a stencil from a series of parts.
   template  static Stencil cat(Ts &&... Parts) {
@@ -140,6 +141,12 @@
 template  Stencil cat(Ts &&... Parts) {
   return Stencil::cat(std::forward(Parts)...);
 }
+/// Convenience wrapper for Stencil constructor of the same type. Declaration
+/// outside of the class supports transition of `Stencil` type to an alias
+/// rather than a class.
+inline Stencil catVector(std::vector Parts) {
+  return Stencil(std::move(Parts));
+}
 
 /// \returns exactly the text provided.
 StencilPart text(llvm::StringRef Text);


Index: clang/include/clang/Tooling/Transformer/Stencil.h
===
--- clang/include/clang/Tooling/Transformer/Stencil.h
+++ clang/include/clang/Tooling/Transformer/Stencil.h
@@ -90,6 +90,7 @@
 class Stencil {
 public:
   Stencil() = default;
+  Stencil(std::vector Parts) : Parts(std::move(Parts)) {}
 
   /// Composes a stencil from a series of parts.
   template  static Stencil cat(Ts &&... Parts) {
@@ -140,6 +141,12 @@
 template  Stencil cat(Ts &&... Parts) {
   return Stencil::cat(std::forward(Parts)...);
 }
+/// Convenience wrapper for Stencil constructor of the same type. Declaration
+/// outside of the class supports transition of `Stencil` type to an alias
+/// rather than a class.
+inline Stencil catVector(std::vector Parts) {
+  return Stencil(std::move(Parts));
+}
 
 /// \returns exactly the text provided.
 StencilPart text(llvm::StringRef Text);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69632: [libTooling] Add Stencil constructor.

2019-11-01 Thread Yitzhak Mandelbaum via Phabricator via cfe-commits
ymandel updated this revision to Diff 227457.
ymandel added a comment.

renamed free function to avoid overloading a templated function.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69632/new/

https://reviews.llvm.org/D69632

Files:
  clang/include/clang/Tooling/Transformer/Stencil.h


Index: clang/include/clang/Tooling/Transformer/Stencil.h
===
--- clang/include/clang/Tooling/Transformer/Stencil.h
+++ clang/include/clang/Tooling/Transformer/Stencil.h
@@ -90,6 +90,7 @@
 class Stencil {
 public:
   Stencil() = default;
+  Stencil(std::vector Parts) : Parts(std::move(Parts)) {}
 
   /// Composes a stencil from a series of parts.
   template  static Stencil cat(Ts &&... Parts) {
@@ -140,6 +141,12 @@
 template  Stencil cat(Ts &&... Parts) {
   return Stencil::cat(std::forward(Parts)...);
 }
+/// Convenience wrapper for Stencil constructor of the same type. Declaration
+/// outside of the class supports transition of `Stencil` type to an alias
+/// rather than a class.
+inline Stencil catVector(std::vector Parts) {
+  return Stencil(std::move(Parts));
+}
 
 /// \returns exactly the text provided.
 StencilPart text(llvm::StringRef Text);


Index: clang/include/clang/Tooling/Transformer/Stencil.h
===
--- clang/include/clang/Tooling/Transformer/Stencil.h
+++ clang/include/clang/Tooling/Transformer/Stencil.h
@@ -90,6 +90,7 @@
 class Stencil {
 public:
   Stencil() = default;
+  Stencil(std::vector Parts) : Parts(std::move(Parts)) {}
 
   /// Composes a stencil from a series of parts.
   template  static Stencil cat(Ts &&... Parts) {
@@ -140,6 +141,12 @@
 template  Stencil cat(Ts &&... Parts) {
   return Stencil::cat(std::forward(Parts)...);
 }
+/// Convenience wrapper for Stencil constructor of the same type. Declaration
+/// outside of the class supports transition of `Stencil` type to an alias
+/// rather than a class.
+inline Stencil catVector(std::vector Parts) {
+  return Stencil(std::move(Parts));
+}
 
 /// \returns exactly the text provided.
 StencilPart text(llvm::StringRef Text);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D69632: [libTooling] Add Stencil constructor.

2019-10-31 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov accepted this revision.
ilya-biryukov added a comment.
This revision is now accepted and ready to land.

LGTM.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69632/new/

https://reviews.llvm.org/D69632



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


[PATCH] D69632: [libTooling] Add Stencil constructor.

2019-10-30 Thread Yitzhak Mandelbaum via Phabricator via cfe-commits
ymandel created this revision.
ymandel added a reviewer: gribozavr.
Herald added a project: clang.
ymandel added a child revision: D69613: [libTooling] Simplify type structure of 
`Stencil`s..

Adds a constructor that takes a vector with which to initialize the `Parts`
field and a corresponding free function that forwards to the constructor. These
definitions are needed to assist in transitioning away from `Stencil` as a class
to defining it as a type alias.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D69632

Files:
  clang/include/clang/Tooling/Transformer/Stencil.h


Index: clang/include/clang/Tooling/Transformer/Stencil.h
===
--- clang/include/clang/Tooling/Transformer/Stencil.h
+++ clang/include/clang/Tooling/Transformer/Stencil.h
@@ -90,6 +90,7 @@
 class Stencil {
 public:
   Stencil() = default;
+  Stencil(std::vector Parts) : Parts(std::move(Parts)) {}
 
   /// Composes a stencil from a series of parts.
   template  static Stencil cat(Ts &&... Parts) {
@@ -140,6 +141,12 @@
 template  Stencil cat(Ts &&... Parts) {
   return Stencil::cat(std::forward(Parts)...);
 }
+/// Convenience wrapper for Stencil constructor of the same type. Declaration
+/// outside of the class supports transition of `Stencil` type to an alias
+/// rather than a class.
+inline Stencil cat(std::vector Parts) {
+  return Stencil(std::move(Parts));
+}
 
 /// \returns exactly the text provided.
 StencilPart text(llvm::StringRef Text);


Index: clang/include/clang/Tooling/Transformer/Stencil.h
===
--- clang/include/clang/Tooling/Transformer/Stencil.h
+++ clang/include/clang/Tooling/Transformer/Stencil.h
@@ -90,6 +90,7 @@
 class Stencil {
 public:
   Stencil() = default;
+  Stencil(std::vector Parts) : Parts(std::move(Parts)) {}
 
   /// Composes a stencil from a series of parts.
   template  static Stencil cat(Ts &&... Parts) {
@@ -140,6 +141,12 @@
 template  Stencil cat(Ts &&... Parts) {
   return Stencil::cat(std::forward(Parts)...);
 }
+/// Convenience wrapper for Stencil constructor of the same type. Declaration
+/// outside of the class supports transition of `Stencil` type to an alias
+/// rather than a class.
+inline Stencil cat(std::vector Parts) {
+  return Stencil(std::move(Parts));
+}
 
 /// \returns exactly the text provided.
 StencilPart text(llvm::StringRef Text);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits