Skip to content

Commit c665a43

Browse files
committed
clang-tidy: Fix misc-use-internal-linkage check
See: https://clang.llvm.org/extra/clang-tidy/checks/misc/use-internal-linkage.html
1 parent 15c77e9 commit c665a43

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

example/calculator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class InitImpl : public Init
3232
}
3333
};
3434

35-
void LogPrint(bool raise, const std::string& message)
35+
static void LogPrint(bool raise, const std::string& message)
3636
{
3737
if (raise) throw std::runtime_error(message);
3838
std::ofstream("debug.log", std::ios_base::app) << message << std::endl;

example/example.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
namespace fs = std::filesystem;
2020

21-
auto Spawn(mp::EventLoop& loop, const std::string& process_argv0, const std::string& new_exe_name)
21+
static auto Spawn(mp::EventLoop& loop, const std::string& process_argv0, const std::string& new_exe_name)
2222
{
2323
int pid;
2424
const int fd = mp::SpawnProcess(pid, [&](int fd) -> std::vector<std::string> {
@@ -30,7 +30,7 @@ auto Spawn(mp::EventLoop& loop, const std::string& process_argv0, const std::str
3030
return std::make_tuple(mp::ConnectStream<InitInterface>(loop, fd), pid);
3131
}
3232

33-
void LogPrint(bool raise, const std::string& message)
33+
static void LogPrint(bool raise, const std::string& message)
3434
{
3535
if (raise) throw std::runtime_error(message);
3636
std::ofstream("debug.log", std::ios_base::app) << message << std::endl;

example/printer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class InitImpl : public Init
2525
std::unique_ptr<Printer> makePrinter() override { return std::make_unique<PrinterImpl>(); }
2626
};
2727

28-
void LogPrint(bool raise, const std::string& message)
28+
static void LogPrint(bool raise, const std::string& message)
2929
{
3030
if (raise) throw std::runtime_error(message);
3131
std::ofstream("debug.log", std::ios_base::app) << message << std::endl;

src/mp/gen.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ static bool GetAnnotationInt32(const Reader& reader, uint64_t id, int32_t* resul
7575
return false;
7676
}
7777

78-
void ForEachMethod(const capnp::InterfaceSchema& interface, const std::function<void(const capnp::InterfaceSchema& interface, const capnp::InterfaceSchema::Method)>& callback)
78+
static void ForEachMethod(const capnp::InterfaceSchema& interface, const std::function<void(const capnp::InterfaceSchema& interface, const capnp::InterfaceSchema::Method)>& callback)
7979
{
8080
for (const auto super : interface.getSuperclasses()) {
8181
ForEachMethod(super, callback);
@@ -89,7 +89,7 @@ using CharSlice = kj::ArrayPtr<const char>;
8989

9090
// Overload for any type with a string .begin(), like kj::StringPtr and kj::ArrayPtr<char>.
9191
template <class OutputStream, class Array, const char* Enable = decltype(std::declval<Array>().begin())()>
92-
OutputStream& operator<<(OutputStream& os, const Array& array)
92+
static OutputStream& operator<<(OutputStream& os, const Array& array)
9393
{
9494
os.write(array.begin(), array.size());
9595
return os;
@@ -107,14 +107,14 @@ struct Format
107107
std::ostringstream m_os;
108108
};
109109

110-
std::string Cap(kj::StringPtr str)
110+
static std::string Cap(kj::StringPtr str)
111111
{
112112
std::string result = str;
113113
if (!result.empty() && 'a' <= result[0] && result[0] <= 'z') result[0] -= 'a' - 'A';
114114
return result;
115115
}
116116

117-
bool BoxedType(const ::capnp::Type& type)
117+
static bool BoxedType(const ::capnp::Type& type)
118118
{
119119
return !(type.isVoid() || type.isBool() || type.isInt8() || type.isInt16() || type.isInt32() || type.isInt64() ||
120120
type.isUInt8() || type.isUInt16() || type.isUInt32() || type.isUInt64() || type.isFloat32() ||
@@ -134,7 +134,7 @@ bool BoxedType(const ::capnp::Type& type)
134134
// include_prefix is "/a/b/c" include lines like
135135
// "#include <d/file.capnp.proxy.h>" "#include <d/file.capnp.proxy-types.h>"i
136136
// will be generated.
137-
void Generate(kj::StringPtr src_prefix,
137+
static void Generate(kj::StringPtr src_prefix,
138138
kj::StringPtr include_prefix,
139139
kj::StringPtr src_file,
140140
const std::vector<kj::StringPtr>& import_paths,

0 commit comments

Comments
 (0)