Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions core/clingutils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ target_include_directories(ClingUtils PRIVATE
# headers from our builtin clang. That's an issue when we are building with bultin_llvm=Off
# and we have installed clang headers, too.
target_include_directories(ClingUtils SYSTEM PRIVATE ${CLANG_INCLUDE_DIRS} ${LLVM_INCLUDE_DIRS})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CLING_CXXFLAGS}")
set_target_properties(ClingUtils PROPERTIES
COMPILE_FLAGS "${CMAKE_CXX_FLAGS} ${CLING_CXXFLAGS}"
VISIBILITY_INLINES_HIDDEN "ON"
)

ROOT_INSTALL_HEADERS()

Expand Down Expand Up @@ -134,7 +137,9 @@ foreach(file ${custom_modulemaps}
Interpreter/RuntimePrintValue.h
Interpreter/RuntimeUniverse.h
Interpreter/RuntimeOptions.h
Interpreter/Value.h)
Interpreter/Value.h
Interpreter/Visibility.h
)
get_filename_component(path ${file} PATH)
set(dest_file ${file})
if (${file} STREQUAL "module.modulemap.build")
Expand Down
7 changes: 4 additions & 3 deletions core/dictgen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
# These files are linked into rootcling_stage1 and libCling. rootcling accesses
# them through rootcling_impl.

ROOT_ADD_COMPILE_OPTIONS(-Wno-class-memaccess)

ROOT_OBJECT_LIBRARY(Dictgen
BaseSelectionRule.cxx
ClassSelectionRule.cxx
Expand Down Expand Up @@ -48,8 +46,11 @@ target_include_directories(Dictgen PRIVATE
# headers from our builtin clang. That's an issue when we are building with bultin_llvm=Off
# and we have installed clang headers, too.
target_include_directories(Dictgen SYSTEM PRIVATE ${CLANG_INCLUDE_DIRS} ${LLVM_INCLUDE_DIRS})
set_target_properties(Dictgen PROPERTIES
COMPILE_FLAGS "${CMAKE_CXX_FLAGS} ${CLING_CXXFLAGS}"
VISIBILITY_INLINES_HIDDEN "ON"
)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CLING_CXXFLAGS}")
CHECK_CXX_COMPILER_FLAG("-fno-rtti" CXX_HAS_fno_rtti)
if(CXX_HAS_fno_rtti)
set_source_files_properties(src/rootcling_impl.cxx PROPERTIES COMPILE_FLAGS "-fno-rtti")
Expand Down
5 changes: 4 additions & 1 deletion core/foundation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ if(MSVC)
target_include_directories(Foundation_Stage1 PRIVATE ${CMAKE_SOURCE_DIR}/core/winnt/inc)
endif()

set_target_properties(Foundation_Stage1 PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} ${CLING_CXXFLAGS}")
set_target_properties(Foundation_Stage1 PROPERTIES
COMPILE_FLAGS "${COMPILE_FLAGS} ${CLING_CXXFLAGS}"
VISIBILITY_INLINES_HIDDEN "ON"
)

ROOT_INSTALL_HEADERS(${FOUNDATION_HEADER_DIRS})
ROOT_ADD_TEST_SUBDIRECTORY(test)
31 changes: 6 additions & 25 deletions core/metacling/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
# symbols from libCore.


set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CLING_CXXFLAGS}")

if(MSVC)
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/TClingCallbacks.cxx COMPILE_FLAGS -GR-)
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/TClingRdictModuleFileExtension.cxx COMPILE_FLAGS -GR-)
Expand Down Expand Up @@ -63,6 +61,11 @@ target_include_directories(MetaCling PRIVATE
${CMAKE_BINARY_DIR}/ginclude
)

set_target_properties(MetaCling PROPERTIES
COMPILE_FLAGS "${CMAKE_CXX_FLAGS} ${CLING_CXXFLAGS}"
VISIBILITY_INLINES_HIDDEN "ON"
)

if(MSVC)
target_include_directories(MetaCling PRIVATE
${CMAKE_SOURCE_DIR}/core/winnt/inc
Expand Down Expand Up @@ -130,29 +133,7 @@ if(MSVC)
??$endl@DU?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@@Z
cling_runtime_internal_throwIfInvalidPointer
?_Facet_Register@std@@YAXPAV_Facet_base@1@@Z
??1Value@cling@@QAE@XZ
?isValid@Value@cling@@QBE_NXZ
?kEmptyCollection@valuePrinterInternal@cling@@3QBDB
?AssertOnUnsupportedTypeCast@Value@cling@@IBEXXZ
?setValueNoAlloc@internal@runtime@cling@@YAXPAX00D@Z
?setValueNoAlloc@internal@runtime@cling@@YAXPAX00DM@Z
?setValueNoAlloc@internal@runtime@cling@@YAXPAX00DN@Z
?setValueNoAlloc@internal@runtime@cling@@YAXPAX00DO@Z
?setValueNoAlloc@internal@runtime@cling@@YAXPAX00D_K@Z
?setValueNoAlloc@internal@runtime@cling@@YAXPAX00DPBX@Z
?setValueWithAlloc@internal@runtime@cling@@YAPAXPAX00D@Z
?printValue@cling@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBI@Z
?printValue@cling@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBM@Z
?printValue@cling@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBN@Z
?printValue@cling@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBH@Z
?printValue@cling@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBX@Z
?printValue@cling@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PB_N@Z
?printValue@cling@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PAPBX@Z
?printValue@cling@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PAPBD@Z
?printValue@cling@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBV23@@Z
??$toUTF8@D@cling@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBDID@Z
?EvaluateDynamicExpression@internal@runtime@cling@@YA?AVValue@3@PAVInterpreter@3@PAVDynamicExprInfo@123@PAVDeclContext@clang@@@Z
)
)
if(MSVC_VERSION LESS 1914)
set(cling_exports ${cling_exports} ??3@YAXPAX0@Z ??_V@YAXPAX0@Z)
endif()
Expand Down
6 changes: 5 additions & 1 deletion interpreter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ else()
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_C_VISIBILITY_PRESET hidden)
endif()
if (NOT MSVC AND NOT APPLE)
ROOT_ADD_CXX_FLAG(CMAKE_CXX_FLAGS "-fno-semantic-interposition")
endif()
set(CMAKE_VISIBILITY_INLINES_HIDDEN "ON")

#--- Build LLVM/Clang with modules -----------------------------------------------------------------
if(cxxmodules)
Expand Down Expand Up @@ -459,7 +463,7 @@ if (builtin_cling)
set(CLING_CXXFLAGS " ${LLVM_DEFS} -DNOMINMAX -D_XKEYCHECK_H")
else()
# FIXME: Work hard to remove -Wno-shadow and -Wno-unused-parameter
set(CLING_CXXFLAGS " ${LLVM_DEFS} -fvisibility=hidden -fno-strict-aliasing -Wwrite-strings -Wno-shadow -Wno-unused-parameter -Wno-deprecated-declarations")
set(CLING_CXXFLAGS " ${LLVM_DEFS} -fno-strict-aliasing -Wwrite-strings -Wno-shadow -Wno-unused-parameter -Wno-deprecated-declarations")
endif()

# Set the flags in the parent scope for the rest of the cling-based libraries in ROOT.
Expand Down
9 changes: 4 additions & 5 deletions interpreter/cling/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -290,10 +290,6 @@ if (LLVM_COMPILER_IS_GCC_COMPATIBLE)
endforeach ()
endif ()

# Lots of cling is needed at runtime (e.g. Value, or Interpreter::Evaluate()).
# The JIT needs to be able to resolve these symbols from cling; unhide them.
string(REPLACE "-fvisibility=hidden" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})

# The package needs to be compiler without RTTI information
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GR-")
Expand Down Expand Up @@ -324,8 +320,11 @@ string(REGEX REPLACE "([0-9]).[0-9]+~[a-zA-Z]+" "\\1" CLING_VERSION_MAJOR ${CLIN
string(REGEX REPLACE "[0-9].([0-9]+)~[a-zA-Z]+" "\\1" CLING_VERSION_MINOR ${CLING_VERSION})

if(DEFINED ROOT_BINARY_DIR)
# Building as part of ROOT.
# Building as part of ROOT; visibility is "inherited" from ROOT/interpreter.
set(CLING_VERSION ROOT_${CLING_VERSION})
else()
# Lots of cling is needed at runtime (e.g. Value, or Interpreter::Evaluate()).
# The JIT needs to be able to resolve these symbols from cling; unhide them.
set(CMAKE_CXX_VISIBILITY_PRESET default)
set(CMAKE_C_VISIBILITY_PRESET default)
set(CMAKE_VISIBILITY_INLINES_HIDDEN "ON")
Expand Down
4 changes: 4 additions & 0 deletions interpreter/cling/include/cling/Interpreter/CValuePrinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@

#ifndef CLING_VALUEPRINTERC_H
#define CLING_VALUEPRINTERC_H

#include <cling/Interpreter/Visibility.h>

#ifdef __cplusplus
extern "C"
#endif
CLING_LIB_EXPORT
void cling_PrintValue(void* /*cling::Value**/ V);

#endif // CLING_VALUEPRINTERC_H
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "cling/Interpreter/DynamicExprInfo.h"
#include "cling/Interpreter/DynamicLookupLifetimeHandler.h"
#include "cling/Interpreter/Value.h"
#include "cling/Interpreter/Visibility.h"

namespace cling {

Expand All @@ -28,6 +29,7 @@ namespace runtime {
namespace internal {
/// \brief Outlined Evaluate() implementation to not include Interpreter.h
/// into the runtime.
CLING_LIB_EXPORT
Value EvaluateDynamicExpression(Interpreter* interp, DynamicExprInfo* DEI,
clang::DeclContext* DC);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#error "This file must not be included by compiled programs."
#endif

#include <cling/Interpreter/Visibility.h>

#include <memory>
#include <string>
#include <tuple>
Expand All @@ -24,6 +26,7 @@ namespace cling {
class Value;

// General fallback - prints the address
CLING_LIB_EXPORT
std::string printValue(const void *ptr);

// Fallback for e.g. vector<bool>'s bit iterator:
Expand All @@ -32,64 +35,90 @@ namespace cling {
inline std::string printValue(const T& val) { return "{not representable}"; }

// void pointer
CLING_LIB_EXPORT
std::string printValue(const void **ptr);

// Bool
CLING_LIB_EXPORT
std::string printValue(const bool *val);

// Chars
CLING_LIB_EXPORT
std::string printValue(const char *val);

CLING_LIB_EXPORT
std::string printValue(const signed char *val);

CLING_LIB_EXPORT
std::string printValue(const unsigned char *val);

CLING_LIB_EXPORT
std::string printValue(const char16_t *val);

CLING_LIB_EXPORT
std::string printValue(const char32_t *val);

CLING_LIB_EXPORT
std::string printValue(const wchar_t *val);

// Ints
CLING_LIB_EXPORT
std::string printValue(const short *val);

CLING_LIB_EXPORT
std::string printValue(const unsigned short *val);

CLING_LIB_EXPORT
std::string printValue(const int *val);

CLING_LIB_EXPORT
std::string printValue(const unsigned int *val);

CLING_LIB_EXPORT
std::string printValue(const long *val);

CLING_LIB_EXPORT
std::string printValue(const unsigned long *val);

CLING_LIB_EXPORT
std::string printValue(const long long *val);

CLING_LIB_EXPORT
std::string printValue(const unsigned long long *val);

// Reals
CLING_LIB_EXPORT
std::string printValue(const float *val);

CLING_LIB_EXPORT
std::string printValue(const double *val);

CLING_LIB_EXPORT
std::string printValue(const long double *val);

// Char pointers
CLING_LIB_EXPORT
std::string printValue(const char *const *val);

CLING_LIB_EXPORT
std::string printValue(const char **val);

// std::string
CLING_LIB_EXPORT
std::string printValue(const std::string *val);

CLING_LIB_EXPORT
std::string printValue(const std::wstring *val);

CLING_LIB_EXPORT
std::string printValue(const std::u16string *val);

CLING_LIB_EXPORT
std::string printValue(const std::u32string *val);

// constant unicode strings, i.e. u"String"
template <typename T>
CLING_LIB_EXPORT
std::string toUTF8(const T* const Src, size_t N, const char Prefix = 0);

template <size_t N>
Expand All @@ -113,17 +142,21 @@ namespace cling {
}

// cling::Value
CLING_LIB_EXPORT
std::string printValue(const Value *value);

namespace valuePrinterInternal {
CLING_LIB_EXPORT
extern const char* const kEmptyCollection;
}

// Collections internal
namespace collectionPrinterInternal {

// Forward declaration, so recursion of containers possible.
template <typename T> std::string printValue(const T* V, const void* = 0);
template <typename T>
CLING_LIB_EXPORT
std::string printValue(const T* V, const void* = 0);

template <typename T> inline std::string
printValue(const T& V, typename std::enable_if<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#ifdef __cplusplus

#include <cling/Interpreter/RuntimeOptions.h>
#include "cling/Interpreter/Visibility.h"
#include <new>

namespace cling {
Expand Down Expand Up @@ -58,6 +59,7 @@ namespace cling {
///\param [in] vpT - The opaque ptr for the cling::Transaction.
///\param [out] vpSVR - The Value that is created.
///
CLING_LIB_EXPORT
void setValueNoAlloc(void* vpI, void* vpSVR, void* vpQT, char vpOn);

///\brief Set the value of the GenericValue for the expression
Expand All @@ -69,6 +71,7 @@ namespace cling {
///\param [in] vpT - The opaque ptr for the cling::Transaction.
///\param [out] vpSVR - The Value that is created.
///
CLING_LIB_EXPORT
void setValueNoAlloc(void* vpI, void* vpV, void* vpQT, char vpOn,
float value);

Expand All @@ -81,6 +84,7 @@ namespace cling {
///\param [in] vpT - The opaque ptr for the cling::Transaction.
///\param [out] vpSVR - The Value that is created.
///
CLING_LIB_EXPORT
void setValueNoAlloc(void* vpI, void* vpV, void* vpQT, char vpOn,
double value);

Expand All @@ -94,6 +98,7 @@ namespace cling {
///\param [in] vpT - The opaque ptr for the cling::Transaction.
///\param [out] vpSVR - The Value that is created.
///
CLING_LIB_EXPORT
void setValueNoAlloc(void* vpI, void* vpV, void* vpQT, char vpOn,
long double value);

Expand All @@ -108,6 +113,7 @@ namespace cling {
///\param [in] vpT - The opaque ptr for the cling::Transaction.
///\param [out] vpSVR - The Value that is created.
///
CLING_LIB_EXPORT
void setValueNoAlloc(void* vpI, void* vpV, void* vpQT, char vpOn,
unsigned long long value);

Expand All @@ -120,6 +126,7 @@ namespace cling {
///\param [in] vpT - The opaque ptr for the cling::Transaction.
///\param [out] vpV - The Value that is created.
///
CLING_LIB_EXPORT
void setValueNoAlloc(void* vpI, void* vpV, void* vpQT, char vpOn,
const void* value);

Expand All @@ -132,6 +139,7 @@ namespace cling {
///
///\returns the address where the value should be put.
///
CLING_LIB_EXPORT
void* setValueWithAlloc(void* vpI, void* vpV, void* vpQT, char vpOn);

///\brief Placement new doesn't work for arrays. It needs to be called on
Expand Down Expand Up @@ -185,7 +193,7 @@ extern "C" {
/// the definition of the exceptions from the RuntimeUniverse and allows us to
/// run cling in -no-rtti mode.
///

CLING_LIB_EXPORT
void* cling_runtime_internal_throwIfInvalidPointer(void* Sema,
void* Expr,
const void* Arg);
Expand Down
Loading