-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Move Controller to phasar-cli * Simplify AnalysisController * Prevent invalid enum values to be accepted by the CLI parser * Add proper error messages in case of fatal failure * simplify linking * breaking changes * remove controller component from Config.cmake.in
- Loading branch information
1 parent
0c7b979
commit 6e0f6f6
Showing
32 changed files
with
211 additions
and
251 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/****************************************************************************** | ||
* Copyright (c) 2024 Fabian Schiebel. | ||
* All rights reserved. This program and the accompanying materials are made | ||
* available under the terms of LICENSE.txt. | ||
* | ||
* Contributors: | ||
* Fabian Schiebel and others | ||
*****************************************************************************/ | ||
|
||
#include "llvm/Support/InitLLVM.h" | ||
|
||
namespace psr { | ||
class InitPhasar : llvm::InitLLVM { | ||
public: | ||
InitPhasar(int &Argc, const char **&Argv) noexcept; | ||
InitPhasar(int &Argc, char **&Argv) noexcept | ||
: InitPhasar(Argc, (const char **&)Argv) {} | ||
}; | ||
} // namespace psr | ||
|
||
#define PSR_INITIALIZER(argc, argv) \ | ||
const ::psr::InitPhasar PsrInitializerVar((argc), (argv)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#include "phasar/Utils/InitPhasar.h" | ||
|
||
#include "phasar/Utils/Logger.h" | ||
|
||
#include "llvm/Support/ErrorHandling.h" | ||
#include "llvm/Support/InitLLVM.h" | ||
#include "llvm/Support/raw_ostream.h" | ||
|
||
using namespace psr; | ||
|
||
#define PSR_ISSUE_TRACKER_URL \ | ||
"https://github.com/secure-software-engineering/phasar/issues" | ||
|
||
InitPhasar::InitPhasar(int &Argc, const char **&Argv) noexcept | ||
: llvm::InitLLVM(Argc, Argv) { | ||
static std::nullptr_t InitGlobals = [] { | ||
// Replace LLVM's bug report URL with ours | ||
llvm::setBugReportMsg("PLEASE create a bug report at " PSR_ISSUE_TRACKER_URL | ||
" and include the crash backtrace.\n "); | ||
|
||
// Install custom error handlers, such that fatal errors do not start with | ||
// "LLVM ERROR" | ||
auto FatalErrorHandler = [](void * /*HandlerData*/, const char *Reason, | ||
bool /*GenCrashDiag*/) { | ||
// Prevent recursion in case our error handler itself fails | ||
llvm::remove_fatal_error_handler(); | ||
llvm::remove_bad_alloc_error_handler(); | ||
|
||
// Write the actual error message | ||
Logger::addLinePrefix(llvm::errs(), SeverityLevel::CRITICAL, | ||
std::nullopt); | ||
llvm::errs() << Reason << '\n'; | ||
llvm::errs().flush(); | ||
}; | ||
|
||
// NOTE: Install the bad_alloc handler before the fatal_error handler due to | ||
// a bug in LLVM | ||
// https://github.com/llvm/llvm-project/issues/83040 | ||
llvm::install_bad_alloc_error_handler(FatalErrorHandler, nullptr); | ||
llvm::install_fatal_error_handler(FatalErrorHandler, nullptr); | ||
// llvm::install_out_of_memory_new_handler() is already done by InitLLVM | ||
return nullptr; | ||
}(); | ||
(void)InitGlobals; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.