[K/N] Add CallsCheckerIgnoreGuard
This commit is contained in:
committed by
Space Team
parent
39e97e5766
commit
43a7711fcc
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright 2010-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "Common.h"
|
||||
#include "Utils.hpp"
|
||||
|
||||
namespace kotlin {
|
||||
|
||||
// Ignore thread state checker for the scope.
|
||||
//
|
||||
// Can be used to ignore specific call sites that are known to be safe.
|
||||
class CallsCheckerIgnoreGuard : private Pinned {
|
||||
public:
|
||||
ALWAYS_INLINE CallsCheckerIgnoreGuard() noexcept;
|
||||
ALWAYS_INLINE ~CallsCheckerIgnoreGuard();
|
||||
};
|
||||
|
||||
}
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <array>
|
||||
#include <cinttypes>
|
||||
|
||||
#include "CallsChecker.hpp"
|
||||
#include "Format.h"
|
||||
#include "KAssert.h"
|
||||
#include "Porting.h"
|
||||
@@ -104,7 +105,7 @@ private:
|
||||
|
||||
class StderrLogger : public logging::internal::Logger {
|
||||
public:
|
||||
NO_EXTERNAL_CALLS_CHECK void Log(logging::Level level, std_support::span<const char* const> tags, std::string_view message) const noexcept override {
|
||||
void Log(logging::Level level, std_support::span<const char* const> tags, std::string_view message) const noexcept override {
|
||||
konan::consoleErrorUtf8(message.data(), message.size());
|
||||
}
|
||||
};
|
||||
@@ -204,6 +205,8 @@ void logging::Log(Level level, std::initializer_list<const char*> tags, const ch
|
||||
}
|
||||
|
||||
void logging::VLog(Level level, std::initializer_list<const char*> tags, const char* format, std::va_list args) noexcept {
|
||||
CallsCheckerIgnoreGuard guard;
|
||||
|
||||
[[clang::no_destroy]] static DefaultLogContext ctx(compiler::runtimeLogs());
|
||||
RuntimeAssert(tags.size() > 0, "Cannot Log without tags");
|
||||
std_support::span<const char* const> tagsSpan(std::data(tags), std::size(tags));
|
||||
|
||||
Reference in New Issue
Block a user