Revert "Accept only true values for CLING_PROFILE and CLING_DEBUG"

This reverts commit a8e50f882e284b1dc47eb60951ef0672490ac31d.
This commit is contained in:
Vassil Vassilev 2022-11-11 17:34:22 +00:00 committed by jenkins
parent 7c1e968336
commit 7bfde53296
3 changed files with 5 additions and 50 deletions

View File

@ -1,38 +0,0 @@
//--------------------------------------------------------------------*- C++ -*-
// CLING - the C++ LLVM-based InterpreterG :)
// author: Guilherme Amadio <amadio@cern.ch>
//
// This file is dual-licensed: you can choose to license it under the University
// of Illinois Open Source License or the GNU Lesser General Public License. See
// LICENSE.TXT for details.
//------------------------------------------------------------------------------
#include <cstdlib>
#include <cstring>
#ifndef CLING_UTILS_UTILS_H
#define CLING_UTILS_UTILS_H
#if defined(_MSC_VER) && !defined(strcasecmp)
#define strcasecmp _stricmp
#endif
namespace cling {
namespace utils {
/** Convert @p value to boolean */
static inline bool ConvertEnvValueToBool(const char* value) {
const char* true_strs[] = {"1", "true", "on", "yes"};
if (!value)
return false;
for (auto str : true_strs)
if (strcasecmp(value, str) == 0)
return true;
return false;
}
} // namespace utils
} // namespace cling
#endif // CLING_UTILS_UTILS_H

View File

@ -15,7 +15,6 @@
#include "cling/Utils/Output.h"
#include "cling/Utils/Paths.h"
#include "cling/Utils/Platform.h"
#include "cling/Utils/Utils.h"
#include "clang/AST/ASTContext.h"
#include "clang/Basic/TargetInfo.h"
@ -1244,11 +1243,6 @@ namespace {
std::vector<const char*> argvCompile(argv, argv+1);
argvCompile.reserve(argc+32);
bool debuggingEnabled =
cling::utils::ConvertEnvValueToBool(std::getenv("CLING_DEBUG"));
bool profilingEnabled =
cling::utils::ConvertEnvValueToBool(std::getenv("CLING_PROFILE"));
#if __APPLE__ && __arm64__
argvCompile.push_back("--target=arm64-apple-darwin20.3.0");
#endif
@ -1331,12 +1325,12 @@ namespace {
#ifdef __linux__
// Keep frame pointer to make JIT stack unwinding reliable for profiling
if (profilingEnabled)
if (std::getenv("CLING_PROFILE"))
argvCompile.push_back("-fno-omit-frame-pointer");
#endif
// Disable optimizations and keep frame pointer when debugging
if (debuggingEnabled)
if (std::getenv("CLING_DEBUG"))
argvCompile.push_back("-O0 -fno-omit-frame-pointer");
// argv[0] already inserted, get the rest
@ -1678,7 +1672,7 @@ namespace {
CGOpts.setInlining(CodeGenOptions::NormalInlining);
// Add debugging info when debugging or profiling
if (debuggingEnabled || profilingEnabled)
if (std::getenv("CLING_DEBUG") || std::getenv("CLING_PROFILE"))
CGOpts.setDebugInfo(clang::codegenoptions::FullDebugInfo);
// CGOpts.EmitDeclMetadata = 1; // For unloading, for later

View File

@ -11,7 +11,6 @@
#include "IncrementalExecutor.h"
#include "cling/Utils/Platform.h"
#include "cling/Utils/Utils.h"
#include "llvm/ExecutionEngine/Orc/Legacy.h"
#include "llvm/ExecutionEngine/SectionMemoryManager.h"
@ -360,12 +359,12 @@ IncrementalJIT::IncrementalJIT(IncrementalExecutor& exe,
llvm::sys::DynamicLibrary::LoadLibraryPermanently(0, 0);
// Enable GDB JIT listener for debugging if CLING_DEBUG is set
if (cling::utils::ConvertEnvValueToBool(std::getenv("CLING_DEBUG")))
if (std::getenv("CLING_DEBUG"))
m_Listeners.push_back(JITEventListener::createGDBRegistrationListener());
#ifdef __linux__
// Enable perf profiling of JITted code on Linux if CLING_PROFILE is set
if (cling::utils::ConvertEnvValueToBool(std::getenv("CLING_PROFILE")))
if (std::getenv("CLING_PROFILE"))
m_Listeners.push_back(cling::createPerfJITEventListener());
#endif