Skip to content

Instantly share code, notes, and snippets.

Mateusz Janek stryku

Block or report user

Report or block stryku

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View CMakeSL - abseil-cpp scripts.md

Links

  • CMakeSL RSS - I'm going to reuse my page feed. I'm not going to post every article at r/cpp or r/cmake, so if you want to be notified about new CMakeSL arts, the RSS is the only reliable way.
  • CMakeSL repo

CMakeSL - abseil-cpp scripts

This article is meant to present what's going on with the CMakeSL project. If you don't know what the CMakeSL is, check out this gist or the readme.

CMakeSL changes

@stryku
stryku / CMakeSL.md
Last active May 8, 2019
CMakeSL (CMake Scripting Language) - An attempt to introduce a new scripting language for CMake
View CMakeSL.md

CMakeSL (CMake Scripting Language) - An attempt to introduce a new scripting language for CMake

Agenda

  • Abstract
  • Video
  • Why
  • How
  • Current status
  • Future plans
  • How to
View recursive-clang-format_5.diff
diff --git a/tools/clang-format/ClangFormat.cpp b/tools/clang-format/ClangFormat.cpp
index 37c2d8b78f..ff71b4aac8 100644
--- a/tools/clang-format/ClangFormat.cpp
+++ b/tools/clang-format/ClangFormat.cpp
@@ -22,6 +22,7 @@
#include "clang/Rewrite/Core/Rewriter.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/Regex.h"
#include "llvm/Support/Signals.h"
View recursive-clang-format_4.cpp
for every listed file
for every passed regex
if file name match regex
format shit out
View recursive-clang-format_3.cpp
static cl::opt<bool> Recursively("r",
cl::desc("Recursively search for <file>s."),
cl::cat(ClangFormatCategory));
View recursive-clang-format_2.cpp
if (Recursively) {
return clang::format::formatRecusively();
}
View recursive-clang-format_1.cpp
static bool formatRecusively() {
std::vector<std::string> files;
if (checkMultipleFilesPreconditions() || findMatchingFiles(files)) {
return false;
}
bool Error = false;
for (unsigned i = 0; i < files.size(); ++i) {
Error |= clang::format::format(files[i]);
View recursive-clang-format_0.cpp
bool findMatchingFiles(std::vector<std::string> &files)
{
SmallVector<char, 256> currentPath;
std::error_code ec;
llvm::sys::fs::file_status fileStatus;
llvm::sys::fs::current_path(currentPath);
for (llvm::sys::fs::recursive_directory_iterator I(currentPath, ec), E;
I != E; I.increment(ec)) {
if (ec) {
View generic_tostring_7.cpp
#include <iostream>
#include <string>
#include <utility>
#include <type_traits>
auto toString(bool b)
{
return b ? "true" : "false";
}
View generic_tostring_example.cpp
#include <iostream>
#include <string>
#include <type_traits>
template <typename T>
std::enable_if_t<std::is_convertible_v<T, std::string>, std::string>
toString(const T& value)
{
return { value };
}
You can’t perform that action at this time.