rshariffdeen / clang-tools

Tools to analyze and modify C/C++ source code
5 stars 1 forks source link

build clang-tools/crochet-patch failed #2

Closed mzs555557 closed 1 year ago

mzs555557 commented 1 year ago

my llvm version is 10.0.0, ubuntu version is 18.0.0, gcc version is 7.0,cmakefile as follows:,

#set(LLVM_DIR "/home/mzs/llvm11/llvm-project/llvm/cmake")
#set(CMAKE_MODULE_PATH "/home/mzs/llvm11/llvm-project/llvm/cmake/modules")

# --------------------------------------------------------------------------------------
set(ENV{LLVM_HOME} "/home/mzs/llvm11/llvm-project/build")

# we need LLVM_HOME in order to automatically set LLVM_DIR
if(NOT DEFINED ENV{LLVM_HOME})
    message(FATAL_ERROR "$LLVM_HOME is not defined")
else ()
    set(ENV{LLVM_DIR} $ENV{LLVM_HOME}/lib/cmake)
endif()
set(LLVM_LINK_COMPONENTS
  Support
  )

add_subdirectory(tool)

find_package(LLVM REQUIRED IR CONFIG)

add_executable(crochetPatch
  lib/ASTDiff.cpp
  lib/ASTPatch.cpp
)
target_link_libraries(crochetPatch
  LINK_LIBS
  clangAST
  clangBasic 
  clangFrontend
  clangLex 
  clangRewrite 
  clangTooling
  clangToolingCore
  )
include_directories(
  ${CMAKE_CURRENT_SOURCE_DIR}
  include
  )

when i build crochet-patch, there are some errors:

Scanning dependencies of target crochetPatch
[ 20%] Building CXX object CMakeFiles/crochetPatch.dir/lib/ASTDiff.o
In file included from /home/mzs/Desktop/SoSReverterExperiment/clang-tools/crochet-patch/lib/ASTDiff.cpp:14:0:
/home/mzs/Desktop/SoSReverterExperiment/clang-tools/crochet-patch/include/crochet/ASTDiff.h: In constructor ‘clang::diff::SyntaxTree::SyntaxTree(T*, clang::ASTUnit&)’:
/home/mzs/Desktop/SoSReverterExperiment/clang-tools/crochet-patch/include/crochet/ASTDiff.h:85:24: error: ‘make_unique’ is not a member of ‘llvm’
       : TreeImpl(llvm::make_unique<Impl>(this, Node, AST)) {}
                        ^~~~~~~~~~~
/home/mzs/Desktop/SoSReverterExperiment/clang-tools/crochet-patch/include/crochet/ASTDiff.h:85:24: note: suggested alternative: ‘make_range’
       : TreeImpl(llvm::make_unique<Impl>(this, Node, AST)) {}
                        ^~~~~~~~~~~
                        make_range
/home/mzs/Desktop/SoSReverterExperiment/clang-tools/crochet-patch/include/crochet/ASTDiff.h:85:40: error: expected primary-expression before ‘>’ token
       : TreeImpl(llvm::make_unique<Impl>(this, Node, AST)) {}
                                        ^
/home/mzs/Desktop/SoSReverterExperiment/clang-tools/crochet-patch/lib/ASTDiff.cpp: In member function ‘bool clang::diff::{anonymous}::PreorderVisitor::TraverseStmt(clang::Stmt*)’:
/home/mzs/Desktop/SoSReverterExperiment/clang-tools/crochet-patch/lib/ASTDiff.cpp:311:14: error: ‘class clang::Stmt’ has no member named ‘IgnoreImplicit’
       S = S->IgnoreImplicit();
              ^~~~~~~~~~~~~~
In file included from /usr/include/c++/7/cassert:44:0,
                 from /usr/local/include/clang/AST/ExprObjC.h:39,
                 from /usr/local/include/clang/AST/RecursiveASTVisitor.h:28,
                 from /usr/local/include/clang/AST/LexicallyOrderedRecursiveASTVisitor.h:17,
                 from /home/mzs/Desktop/SoSReverterExperiment/clang-tools/crochet-patch/lib/ASTDiff.cpp:16:
/home/mzs/Desktop/SoSReverterExperiment/clang-tools/crochet-patch/lib/ASTDiff.cpp: In function ‘clang::diff::HashType clang::diff::hashNode(clang::diff::NodeRef)’:
/home/mzs/Desktop/SoSReverterExperiment/clang-tools/crochet-patch/lib/ASTDiff.cpp:440:13: error: ‘Failure’ was not declared in this scope
     assert(!Failure);
             ^
/home/mzs/Desktop/SoSReverterExperiment/clang-tools/crochet-patch/lib/ASTDiff.cpp: In constructor ‘clang::diff::ZhangShashaMatcher::ZhangShashaMatcher(const clang::diff::ASTDiff::Impl&, clang::diff::NodeRef, clang::diff::NodeRef)’:
/home/mzs/Desktop/SoSReverterExperiment/clang-tools/crochet-patch/lib/ASTDiff.cpp:543:22: error: ‘make_unique’ is not a member of ‘llvm’
     TreeDist = llvm::make_unique<std::unique_ptr<double[]>[]>(
                      ^~~~~~~~~~~
/home/mzs/Desktop/SoSReverterExperiment/clang-tools/crochet-patch/lib/ASTDiff.cpp:543:22: note: suggested alternative: ‘make_range’
     TreeDist = llvm::make_unique<std::unique_ptr<double[]>[]>(
                      ^~~~~~~~~~~
                      make_range
/home/mzs/Desktop/SoSReverterExperiment/clang-tools/crochet-patch/lib/ASTDiff.cpp:543:59: error: expected primary-expression before ‘[’ token
     TreeDist = llvm::make_unique<std::unique_ptr<double[]>[]>(
                                                           ^
/home/mzs/Desktop/SoSReverterExperiment/clang-tools/crochet-patch/lib/ASTDiff.cpp:543:60: error: expected primary-expression before ‘]’ token
     TreeDist = llvm::make_unique<std::unique_ptr<double[]>[]>(
                                                            ^
/home/mzs/Desktop/SoSReverterExperiment/clang-tools/crochet-patch/lib/ASTDiff.cpp:545:24: error: ‘make_unique’ is not a member of ‘llvm’
     ForestDist = llvm::make_unique<std::unique_ptr<double[]>[]>(
                        ^~~~~~~~~~~
/home/mzs/Desktop/SoSReverterExperiment/clang-tools/crochet-patch/lib/ASTDiff.cpp:545:24: note: suggested alternative: ‘make_range’
     ForestDist = llvm::make_unique<std::unique_ptr<double[]>[]>(
                        ^~~~~~~~~~~
                        make_range
/home/mzs/Desktop/SoSReverterExperiment/clang-tools/crochet-patch/lib/ASTDiff.cpp:545:61: error: expected primary-expression before ‘[’ token
     ForestDist = llvm::make_unique<std::unique_ptr<double[]>[]>(
                                                             ^
/home/mzs/Desktop/SoSReverterExperiment/clang-tools/crochet-patch/lib/ASTDiff.cpp:545:62: error: expected primary-expression before ‘]’ token
     ForestDist = llvm::make_unique<std::unique_ptr<double[]>[]>(
                                                              ^
/home/mzs/Desktop/SoSReverterExperiment/clang-tools/crochet-patch/lib/ASTDiff.cpp:548:27: error: ‘make_unique’ is not a member of ‘llvm’
       TreeDist[I] = llvm::make_unique<double[]>(size_t(S2.getSize()) + 1);
                           ^~~~~~~~~~~
/home/mzs/Desktop/SoSReverterExperiment/clang-tools/crochet-patch/lib/ASTDiff.cpp:548:27: note: suggested alternative: ‘make_range’
       TreeDist[I] = llvm::make_unique<double[]>(size_t(S2.getSize()) + 1);
                           ^~~~~~~~~~~
                           make_range
/home/mzs/Desktop/SoSReverterExperiment/clang-tools/crochet-patch/lib/ASTDiff.cpp:548:39: error: expected primary-expression before ‘double’
       TreeDist[I] = llvm::make_unique<double[]>(size_t(S2.getSize()) + 1);
                                       ^~~~~~
/home/mzs/Desktop/SoSReverterExperiment/clang-tools/crochet-patch/lib/ASTDiff.cpp:549:29: error: ‘make_unique’ is not a member of ‘llvm’
       ForestDist[I] = llvm::make_unique<double[]>(size_t(S2.getSize()) + 1);
                             ^~~~~~~~~~~
/home/mzs/Desktop/SoSReverterExperiment/clang-tools/crochet-patch/lib/ASTDiff.cpp:549:29: note: suggested alternative: ‘make_range’
       ForestDist[I] = llvm::make_unique<double[]>(size_t(S2.getSize()) + 1);
                             ^~~~~~~~~~~
                             make_range
/home/mzs/Desktop/SoSReverterExperiment/clang-tools/crochet-patch/lib/ASTDiff.cpp:549:41: error: expected primary-expression before ‘double’
       ForestDist[I] = llvm::make_unique<double[]>(size_t(S2.getSize()) + 1);
                                         ^~~~~~
/home/mzs/Desktop/SoSReverterExperiment/clang-tools/crochet-patch/lib/ASTDiff.cpp: In constructor ‘clang::diff::ASTDiff::Impl::Impl(clang::diff::SyntaxTree::Impl&, clang::diff::SyntaxTree::Impl&, const clang::diff::ComparisonOptions&)’:
/home/mzs/Desktop/SoSReverterExperiment/clang-tools/crochet-patch/lib/ASTDiff.cpp:1311:20: error: ‘make_unique’ is not a member of ‘llvm’
   SrcToDst = llvm::make_unique<NodeId[]>(Size);
                    ^~~~~~~~~~~
/home/mzs/Desktop/SoSReverterExperiment/clang-tools/crochet-patch/lib/ASTDiff.cpp:1311:20: note: suggested alternative: ‘make_range’
   SrcToDst = llvm::make_unique<NodeId[]>(Size);
                    ^~~~~~~~~~~
                    make_range
/home/mzs/Desktop/SoSReverterExperiment/clang-tools/crochet-patch/lib/ASTDiff.cpp:1311:38: error: expected primary-expression before ‘[’ token
   SrcToDst = llvm::make_unique<NodeId[]>(Size);
                                      ^
/home/mzs/Desktop/SoSReverterExperiment/clang-tools/crochet-patch/lib/ASTDiff.cpp:1311:39: error: expected primary-expression before ‘]’ token
   SrcToDst = llvm::make_unique<NodeId[]>(Size);
                                       ^
/home/mzs/Desktop/SoSReverterExperiment/clang-tools/crochet-patch/lib/ASTDiff.cpp:1312:20: error: ‘make_unique’ is not a member of ‘llvm’
   DstToSrc = llvm::make_unique<NodeId[]>(Size);
                    ^~~~~~~~~~~
/home/mzs/Desktop/SoSReverterExperiment/clang-tools/crochet-patch/lib/ASTDiff.cpp:1312:20: note: suggested alternative: ‘make_range’
   DstToSrc = llvm::make_unique<NodeId[]>(Size);
                    ^~~~~~~~~~~
                    make_range
/home/mzs/Desktop/SoSReverterExperiment/clang-tools/crochet-patch/lib/ASTDiff.cpp:1312:38: error: expected primary-expression before ‘[’ token
   DstToSrc = llvm::make_unique<NodeId[]>(Size);
                                      ^
/home/mzs/Desktop/SoSReverterExperiment/clang-tools/crochet-patch/lib/ASTDiff.cpp:1312:39: error: expected primary-expression before ‘]’ token
   DstToSrc = llvm::make_unique<NodeId[]>(Size);
                                       ^
/home/mzs/Desktop/SoSReverterExperiment/clang-tools/crochet-patch/lib/ASTDiff.cpp: In constructor ‘clang::diff::ASTDiff::ASTDiff(clang::diff::SyntaxTree&, clang::diff::SyntaxTree&, const clang::diff::ComparisonOptions&)’:
/home/mzs/Desktop/SoSReverterExperiment/clang-tools/crochet-patch/lib/ASTDiff.cpp:1418:22: error: ‘make_unique’ is not a member of ‘llvm’
     : DiffImpl(llvm::make_unique<Impl>(*T1.TreeImpl, *T2.TreeImpl, Options)) {}
                      ^~~~~~~~~~~
/home/mzs/Desktop/SoSReverterExperiment/clang-tools/crochet-patch/lib/ASTDiff.cpp:1418:22: note: suggested alternative: ‘make_range’
     : DiffImpl(llvm::make_unique<Impl>(*T1.TreeImpl, *T2.TreeImpl, Options)) {}
                      ^~~~~~~~~~~
                      make_range
/home/mzs/Desktop/SoSReverterExperiment/clang-tools/crochet-patch/lib/ASTDiff.cpp:1418:38: error: expected primary-expression before ‘>’ token
     : DiffImpl(llvm::make_unique<Impl>(*T1.TreeImpl, *T2.TreeImpl, Options)) {}
                                      ^
/home/mzs/Desktop/SoSReverterExperiment/clang-tools/crochet-patch/lib/ASTDiff.cpp: In constructor ‘clang::diff::SyntaxTree::SyntaxTree(clang::ASTUnit&)’:
/home/mzs/Desktop/SoSReverterExperiment/clang-tools/crochet-patch/lib/ASTDiff.cpp:1489:22: error: ‘make_unique’ is not a member of ‘llvm’
     : TreeImpl(llvm::make_unique<SyntaxTree::Impl>(
                      ^~~~~~~~~~~
/home/mzs/Desktop/SoSReverterExperiment/clang-tools/crochet-patch/lib/ASTDiff.cpp:1489:22: note: suggested alternative: ‘make_range’
     : TreeImpl(llvm::make_unique<SyntaxTree::Impl>(
                      ^~~~~~~~~~~
                      make_range
/home/mzs/Desktop/SoSReverterExperiment/clang-tools/crochet-patch/lib/ASTDiff.cpp:1489:50: error: expected primary-expression before ‘>’ token
     : TreeImpl(llvm::make_unique<SyntaxTree::Impl>(
                                                  ^
CMakeFiles/crochetPatch.dir/build.make:62: recipe for target 'CMakeFiles/crochetPatch.dir/lib/ASTDiff.o' failed
make[2]: *** [CMakeFiles/crochetPatch.dir/lib/ASTDiff.o] Error 1
CMakeFiles/Makefile2:99: recipe for target 'CMakeFiles/crochetPatch.dir/all' failed
make[1]: *** [CMakeFiles/crochetPatch.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2
mzs555557 commented 1 year ago

solve it :)