Commit bbc51806 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

Apply clang-format to folly/gen/ (partial: namespace)

Summary:
[Folly] Apply `clang-format` to `folly/gen/` (partial: namespace).

With some manual rearrangement in the places where `clang-format` does awkward things, with the result that clang-format over `folly/gen/` becomes a no-op.

Reviewed By: Orvid

Differential Revision: D5177428

fbshipit-source-id: 17f51d00454a7be7f29dcf1a2ff3d0eaf1de72ab
parent 1b67e9aa
...@@ -22,7 +22,8 @@ ...@@ -22,7 +22,8 @@
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow" #pragma GCC diagnostic ignored "-Wshadow"
namespace folly { namespace gen { namespace folly {
namespace gen {
/** /**
* ArgumentReference - For determining ideal argument type to receive a value. * ArgumentReference - For determining ideal argument type to receive a value.
...@@ -2336,7 +2337,7 @@ inline detail::Skip skip(size_t count) { return detail::Skip(count); } ...@@ -2336,7 +2337,7 @@ inline detail::Skip skip(size_t count) { return detail::Skip(count); }
inline detail::Batch batch(size_t batchSize) { inline detail::Batch batch(size_t batchSize) {
return detail::Batch(batchSize); return detail::Batch(batchSize);
} }
} // gen
}} // folly::gen } // folly
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
...@@ -78,9 +78,10 @@ ...@@ -78,9 +78,10 @@
* *
* To learn more about this library, including the use of infinite generators, * To learn more about this library, including the use of infinite generators,
* see the examples in the comments, or the docs (coming soon). * see the examples in the comments, or the docs (coming soon).
*/ */
namespace folly { namespace gen { namespace folly {
namespace gen {
class Less { class Less {
public: public:
...@@ -814,7 +815,7 @@ template<class Fallback, ...@@ -814,7 +815,7 @@ template<class Fallback,
UnwrapOr unwrapOr(Fallback&& fallback) { UnwrapOr unwrapOr(Fallback&& fallback) {
return UnwrapOr(std::forward<Fallback>(fallback)); return UnwrapOr(std::forward<Fallback>(fallback));
} }
} // gen
}} // folly::gen } // folly
#include <folly/gen/Base-inl.h> #include <folly/gen/Base-inl.h>
...@@ -201,7 +201,7 @@ class MergeTuples { ...@@ -201,7 +201,7 @@ class MergeTuples {
} }
}; };
} // namespace detail } // namespace detail
// TODO(mcurtiss): support zip() for N>1 operands. Because of variadic problems, // TODO(mcurtiss): support zip() for N>1 operands. Because of variadic problems,
// this might not be easily possible until gcc4.8 is available. // this might not be easily possible until gcc4.8 is available.
...@@ -211,5 +211,5 @@ Zip zip(Source&& source) { ...@@ -211,5 +211,5 @@ Zip zip(Source&& source) {
return Zip(std::forward<Source>(source)); return Zip(std::forward<Source>(source));
} }
} // namespace gen } // namespace gen
} // namespace folly } // namespace folly
...@@ -29,7 +29,7 @@ class Interleave; ...@@ -29,7 +29,7 @@ class Interleave;
template<class Container> template<class Container>
class Zip; class Zip;
} // namespace detail } // namespace detail
template<class Source2, template<class Source2,
class Source2Decayed = typename std::decay<Source2>::type, class Source2Decayed = typename std::decay<Source2>::type,
...@@ -38,7 +38,7 @@ Interleave interleave(Source2&& source2) { ...@@ -38,7 +38,7 @@ Interleave interleave(Source2&& source2) {
return Interleave(std::forward<Source2>(source2)); return Interleave(std::forward<Source2>(source2));
} }
} // namespace gen } // namespace gen
} // namespace folly } // namespace folly
#include <folly/gen/Combine-inl.h> #include <folly/gen/Combine-inl.h>
...@@ -25,7 +25,8 @@ ...@@ -25,7 +25,8 @@
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow" #pragma GCC diagnostic ignored "-Wshadow"
namespace folly { namespace gen { namespace folly {
namespace gen {
/** /**
* IsCompatibleSignature - Trait type for testing whether a given Functor * IsCompatibleSignature - Trait type for testing whether a given Functor
...@@ -372,7 +373,7 @@ public: ...@@ -372,7 +373,7 @@ public:
}; };
} // detail } // detail
} // gen
}} // folly::gen } // folly
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
...@@ -17,7 +17,8 @@ ...@@ -17,7 +17,8 @@
#pragma once #pragma once
#define FOLLY_GEN_CORE_H_ #define FOLLY_GEN_CORE_H_
namespace folly { namespace gen { namespace folly {
namespace gen {
template<class Value, class Self> template<class Value, class Self>
class GenImpl; class GenImpl;
...@@ -37,7 +38,7 @@ template<class Value, class First, class Second> ...@@ -37,7 +38,7 @@ template<class Value, class First, class Second>
class Chain; class Chain;
} // detail } // detail
} // gen
}} // folly::gen } // folly
#include <folly/gen/Core-inl.h> #include <folly/gen/Core-inl.h>
...@@ -129,7 +129,7 @@ inline auto byLineImpl(File file, char delim, bool keepDelimiter) ...@@ -129,7 +129,7 @@ inline auto byLineImpl(File file, char delim, bool keepDelimiter)
| resplit(delim, keepDelimiter); | resplit(delim, keepDelimiter);
} }
} // !detail } // !detail
/** /**
* Generator which reads lines from a file. * Generator which reads lines from a file.
...@@ -161,4 +161,5 @@ inline auto byLine(int fd, char delim = '\n') ...@@ -161,4 +161,5 @@ inline auto byLine(int fd, char delim = '\n')
inline auto byLine(const char* f, char delim = '\n') inline auto byLine(const char* f, char delim = '\n')
-> decltype(byLine(File(f), delim)) { return byLine(File(f), delim); } -> decltype(byLine(File(f), delim)) { return byLine(File(f), delim); }
}} // !folly::gen } // !gen
} // !folly
...@@ -27,7 +27,7 @@ namespace gen { ...@@ -27,7 +27,7 @@ namespace gen {
namespace detail { namespace detail {
class FileReader; class FileReader;
class FileWriter; class FileWriter;
} // namespace detail } // namespace detail
/** /**
* Generator that reads from a file with a buffer of the given size. * Generator that reads from a file with a buffer of the given size.
...@@ -64,7 +64,7 @@ template <class S = detail::FileWriter> ...@@ -64,7 +64,7 @@ template <class S = detail::FileWriter>
S toFile(File file, std::unique_ptr<IOBuf> buffer) { S toFile(File file, std::unique_ptr<IOBuf> buffer) {
return S(std::move(file), std::move(buffer)); return S(std::move(file), std::move(buffer));
} }
} // !gen
}} // !folly::gen } // !folly
#include <folly/gen/File-inl.h> #include <folly/gen/File-inl.h>
...@@ -21,7 +21,8 @@ ...@@ -21,7 +21,8 @@
#include <folly/gen/Base.h> #include <folly/gen/Base.h>
namespace folly { namespace gen { namespace folly {
namespace gen {
namespace detail { namespace detail {
template <class Ops> template <class Ops>
...@@ -102,7 +103,7 @@ template <class Sink, class Sub = detail::Sub<Sink>> ...@@ -102,7 +103,7 @@ template <class Sink, class Sub = detail::Sub<Sink>>
Sub sub(Sink sink) { Sub sub(Sink sink) {
return Sub(std::move(sink)); return Sub(std::move(sink));
} }
} // !namespace gen
}} // !namespace folly::gen } // !namespace folly
#include <folly/gen/Parallel-inl.h> #include <folly/gen/Parallel-inl.h>
...@@ -28,7 +28,9 @@ ...@@ -28,7 +28,9 @@
#include <folly/MPMCPipeline.h> #include <folly/MPMCPipeline.h>
#include <folly/experimental/EventCount.h> #include <folly/experimental/EventCount.h>
namespace folly { namespace gen { namespace detail { namespace folly {
namespace gen {
namespace detail {
/** /**
* PMap - Map in parallel (using threads). For producing a sequence of * PMap - Map in parallel (using threads). For producing a sequence of
...@@ -250,5 +252,6 @@ class PMap : public Operator<PMap<Predicate>> { ...@@ -250,5 +252,6 @@ class PMap : public Operator<PMap<Predicate>> {
return Gen(source.self(), pred_, nThreads_); return Gen(source.self(), pred_, nThreads_);
} }
}; };
} // namespace detail
}}} // namespaces } // namespace gen
} // namespace folly
...@@ -19,14 +19,15 @@ ...@@ -19,14 +19,15 @@
#include <folly/gen/Core.h> #include <folly/gen/Core.h>
namespace folly { namespace gen { namespace folly {
namespace gen {
namespace detail { namespace detail {
template<class Predicate> template<class Predicate>
class PMap; class PMap;
} // namespace detail } // namespace detail
/** /**
* Run `pred` in parallel in nThreads. Results are returned in the * Run `pred` in parallel in nThreads. Results are returned in the
...@@ -42,7 +43,7 @@ template<class Predicate, ...@@ -42,7 +43,7 @@ template<class Predicate,
PMap pmap(Predicate pred = Predicate(), size_t nThreads = 0) { PMap pmap(Predicate pred = Predicate(), size_t nThreads = 0) {
return PMap(std::move(pred), nThreads); return PMap(std::move(pred), nThreads);
} }
} // namespace gen
}} // namespaces } // namespace folly
#include <folly/gen/ParallelMap-inl.h> #include <folly/gen/ParallelMap-inl.h>
...@@ -412,7 +412,7 @@ class SplitTo { ...@@ -412,7 +412,7 @@ class SplitTo {
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
} // namespace detail } // namespace detail
} // namespace gen } // namespace gen
} // namespace folly } // namespace folly
...@@ -41,7 +41,7 @@ template<class TargetContainer, ...@@ -41,7 +41,7 @@ template<class TargetContainer,
class... Targets> class... Targets>
class SplitTo; class SplitTo;
} // namespace detail } // namespace detail
/** /**
* Split the output from a generator into StringPiece "lines" delimited by * Split the output from a generator into StringPiece "lines" delimited by
...@@ -242,7 +242,7 @@ StreamSplitter<Callback> streamSplitter(char delimiter, ...@@ -242,7 +242,7 @@ StreamSplitter<Callback> streamSplitter(char delimiter,
return StreamSplitter<Callback>(delimiter, std::move(pieceCb), capacity); return StreamSplitter<Callback>(delimiter, std::move(pieceCb), capacity);
} }
} // namespace gen } // namespace gen
} // namespace folly } // namespace folly
#include <folly/gen/String-inl.h> #include <folly/gen/String-inl.h>
...@@ -918,7 +918,7 @@ class TestIntSeq : public GenImpl<int, TestIntSeq> { ...@@ -918,7 +918,7 @@ class TestIntSeq : public GenImpl<int, TestIntSeq> {
TestIntSeq& operator=(const TestIntSeq&) = delete; TestIntSeq& operator=(const TestIntSeq&) = delete;
}; };
} // namespace } // namespace
TEST(Gen, NoGeneratorCopies) { TEST(Gen, NoGeneratorCopies) {
EXPECT_EQ(15, TestIntSeq() | sum); EXPECT_EQ(15, TestIntSeq() | sum);
......
...@@ -61,7 +61,7 @@ void initStringResplitterBenchmark() { ...@@ -61,7 +61,7 @@ void initStringResplitterBenchmark() {
size_t len(folly::StringPiece s) { return s.size(); } size_t len(folly::StringPiece s) { return s.size(); }
} // namespace } // namespace
BENCHMARK(StringResplitter_Big, iters) { BENCHMARK(StringResplitter_Big, iters) {
size_t s = 0; size_t s = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment