mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
ab125b35b0
Change company name to "rev.ng Labs Srl" in all license headers to reflect changed company name and legal status Add missing license headers to files that didn't have one
40 lines
1.3 KiB
C++
40 lines
1.3 KiB
C++
//
|
|
// Copyright rev.ng Labs Srl. See LICENSE.md for details.
|
|
//
|
|
|
|
#include <utility>
|
|
|
|
#include "clang/Tooling/Tooling.h"
|
|
|
|
#include "revng-c/ThreadSafeClangTooling/ThreadSafeClangTooling.h"
|
|
|
|
namespace revng {
|
|
namespace c {
|
|
|
|
const std::vector<std::string> ClangToolDefaultArgs{ // C language
|
|
"-xc",
|
|
// C11 dialect
|
|
"-std=c11"
|
|
};
|
|
|
|
} // namespace c
|
|
} // namespace revng
|
|
|
|
std::mutex ClangToolingMutex;
|
|
|
|
bool runThreadSafeClangTool(std::unique_ptr<clang::FrontendAction> ToolAction,
|
|
const std::string &Code,
|
|
const std::vector<std::string> &Args) {
|
|
std::scoped_lock ClangToolingGuard{ ClangToolingMutex };
|
|
return clang::tooling::runToolOnCodeWithArgs(std::move(ToolAction),
|
|
Code,
|
|
Args);
|
|
}
|
|
|
|
bool runThreadSafeClangTool(std::unique_ptr<clang::FrontendAction> ToolAction,
|
|
const std::string &Code) {
|
|
return runThreadSafeClangTool(std::move(ToolAction),
|
|
Code,
|
|
revng::c::ClangToolDefaultArgs);
|
|
}
|