Skip to content

Commit

Permalink
Remove ForceSymbolsAsUsed from Interpreter.h.
Browse files Browse the repository at this point in the history
  • Loading branch information
marsupial authored and sftnight committed Dec 20, 2016
1 parent a7bb139 commit dbb5aa6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
12 changes: 0 additions & 12 deletions include/cling/Interpreter/Interpreter.h
Original file line number Diff line number Diff line change
Expand Up @@ -711,18 +711,6 @@ namespace cling {

friend class runtime::internal::LifetimeHandler;
};

namespace internal {
// Force symbols needed by runtime to be included in binaries.
void symbol_requester();
static struct ForceSymbolsAsUsed {
ForceSymbolsAsUsed(){
// Never true, but don't tell the compiler.
// Prevents stripping the symbol due to dead-code optimization.
if (std::atoi("0")) symbol_requester();
}
} sForceSymbolsAsUsed;
}
} // namespace cling

#endif // CLING_INTERPRETER_H
9 changes: 9 additions & 0 deletions lib/Interpreter/Interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ namespace cling {
== clang::frontend::ParseSyntaxOnly;
}

namespace internal { void symbol_requester(); }

Interpreter::Interpreter(int argc, const char* const *argv,
const char* llvmdir /*= 0*/, bool noRuntime,
const Interpreter* parentInterp) :
Expand Down Expand Up @@ -207,6 +209,13 @@ namespace cling {
}

m_IncrParser->SetTransformers(parentInterp);

if (!m_LLVMContext) {
// Never true, but don't tell the compiler.
// Force symbols needed by runtime to be included in binaries.
// Prevents stripping the symbol due to dead-code optimization.
internal::symbol_requester();
}
}

///\brief Constructor for the child Interpreter.
Expand Down

0 comments on commit dbb5aa6

Please sign in to comment.