Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
3 changes: 0 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,6 @@ jobs:
else
cmake -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DUSE_CLING=OFF \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@faze-geek If use_repl has been made the default then we should be able to remove all the uses of use_cling=off, since it should be off by default.

-DUSE_REPL=ON \
-DCPPINTEROP_INCLUDE_DOCS=${{ matrix.documentation }} \
-DLLVM_DIR=$LLVM_BUILD_DIR/lib/cmake/llvm \
-DClang_DIR=$LLVM_BUILD_DIR/lib/cmake/clang \
Expand Down Expand Up @@ -977,7 +976,6 @@ jobs:
{
cmake -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} `
-DUSE_CLING=OFF `
-DUSE_REPL=ON `
-DLLVM_DIR="$env:LLVM_BUILD_DIR\lib\cmake\llvm" `
-DLLVM_ENABLE_WERROR=On `
-DClang_DIR="$env:LLVM_BUILD_DIR\lib\cmake\clang" -DCODE_COVERAGE=${{ env.CODE_COVERAGE }} -DCMAKE_INSTALL_PREFIX="$env:CPPINTEROP_DIR" ..\
Expand Down Expand Up @@ -1272,7 +1270,6 @@ jobs:
else
emcmake cmake -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DUSE_CLING=OFF \
-DUSE_REPL=ON \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest he goes through all workflows in the repo.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for letting me know.

-DCMAKE_PREFIX_PATH=$PREFIX \
-DLLVM_DIR=$LLVM_BUILD_DIR/lib/cmake/llvm \
-DClang_DIR=$LLVM_BUILD_DIR/lib/cmake/clang \
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
endif()

option(USE_CLING "Use Cling as backend" OFF)
option(USE_REPL "Use clang-repl as backend" OFF)
option(USE_REPL "Use clang-repl as backend" ON)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the block below points out the following

  if (USE_CLING AND USE_REPL)
    message(FATAL_ERROR "We can only use Cling (USE_CLING=On) or Repl (USE_REPL=On), but not both of them.")
  endif()

What can be done if we are using REPL as default .... is to make cling and REPL mutually exclusive. Which means we only use 1 of these by default.

  1. REPL by default , cling off by default
  2. And if cling is made on .... you can set(USE_CLING ON) and unset(USE_REPL) or anything related in cmake.

So that if we encounter something like (the case you've not addressed yet)

-DUSE_CLING=ON \
-DUSE_REPL=OFF \

We can just use USE_CLING and we don't need to explicitly set REPL to off.

Copy link
Collaborator

@anutosh491 anutosh491 Dec 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we just end up with either the default case (which is supplying nothing, understood that repl is on and cling is off) or we just use cling=ON (understood repl would be off)

And if both if on by some chance we have the fatal error message.


if (USE_CLING AND USE_REPL)
message(FATAL_ERROR "We can only use Cling (USE_CLING=On) or Repl (USE_REPL=On), but not both of them.")
Expand Down
2 changes: 0 additions & 2 deletions lib/Interpreter/Compatibility.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ inline void codeComplete(std::vector<std::string>& Results,

#endif // USE_CLING

#ifdef USE_REPL

#include "DynamicLibraryManager.h"
#include "clang/AST/Mangle.h"
Expand Down Expand Up @@ -403,7 +402,6 @@ namespace compat {
using Interpreter = Cpp::Interpreter;
}

#endif // USE_REPL

namespace compat {

Expand Down
7 changes: 1 addition & 6 deletions unittests/CppInterOp/InterpreterTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
#include "cling/Interpreter/Interpreter.h"
#endif // USE_CLING

#ifdef USE_REPL
#include "clang/Interpreter/Interpreter.h"
#endif // USE_REPL

#include "clang/Basic/Version.h"

Expand Down Expand Up @@ -175,7 +173,6 @@ TEST(InterpreterTest, CodeCompletion) {

TEST(InterpreterTest, ExternalInterpreterTest) {

#ifdef USE_REPL
llvm::ExitOnError ExitOnErr;
clang::IncrementalCompilerBuilder CB;
CB.SetCompilerArgs({"-std=c++20"});
Expand All @@ -188,7 +185,6 @@ TEST(InterpreterTest, ExternalInterpreterTest) {
std::unique_ptr<clang::Interpreter> I =
ExitOnErr(clang::Interpreter::create(std::move(CI)));
auto ExtInterp = I.get();
#endif

#ifdef USE_CLING
std::string MainExecutableName = sys::fs::getMainExecutable(nullptr, nullptr);
Expand All @@ -203,9 +199,8 @@ TEST(InterpreterTest, ExternalInterpreterTest) {
Cpp::UseExternalInterpreter(ExtInterp);
EXPECT_TRUE(Cpp::GetInterpreter()) << "External Interpreter not set";

#ifdef USE_REPL
I.release();
#endif

#ifdef USE_CLING
delete ExtInterp;
#endif
Expand Down
Loading