Code Monkey home page Code Monkey logo

angha's Introduction

Project Angha

Project Angha provides an infrastructure for creating synthetic compilable C benchmarks out of publicly available code repositories. Using a combination of web-crawling, compiler frontend extension and type reconstruction, this framework allows one to create a virtually unbounded number of compilable programs.

This framework has three main components, whose requirements need to be met for it to be usable. Refer to the documentation within each of these subprojects to use them. They are:

  • Web-crawler - contained within src/crawler, this Java application collects publicly available C code using GitHub's public API.
  • Psyche-C - this external project, included as a submodule in src/psychec, is a type reconstruction engine for C. It receives as input an incomplete program, and builds a compilable version of it through type inference.
  • Function Extractor - contained within src/extractor, this tool uses a combination of Clang frontend extensions, the aforementioned Psyche-C engine, and Python to build a collection of compilable programs, from a corpus of raw C repositories.

To use the project, clone the repository with the --recursive flag, then follow the instructions to build and use each subproject.

angha's People

Contributors

brenocfg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

angha's Issues

Can't find Function Extractor after using cmake

Hi, I ran into an error when I was using the function extractor. After executing the code cmake ../ -DLLVM_DIR=${LLVM_BUILD_DIR}/lib/cmake/llvm -DClang_DIR=${LLVM_BUILD_DIR}/lib/cmake/clang in README.md, I could not find the "shared library file in the /lib/ directory" in my LLVM build folder. It seems that there is something to specify in the step to "create the Makefiles for your LLVM build then compile it". I could not find "libFunctionExtractor.so" either.

Below is my working process.

Input:
$ cmake ../ -DLLVM_DIR=${LLVM_BUILD_DIR}/lib/cmake/llvm -DClang_DIR=${LLVM_BUILD_DIR}/lib/cmake/clang -DZLIB_INCLUDE_DIR=/usr/include -DZLIB_LIBRARY=/usr/lib

Output:

CMake Warning (dev) in CMakeLists.txt:

  No project() command is present.  The top-level CMakeLists.txt file must

  contain a literal, direct call to the project() command.  Add a line of

  code such as



    project(ProjectName)



  near the top of the file, but after cmake_minimum_required().



  CMake is pretending there is a "project(Project)" command on the first

  line.

This warning is for project developers.  Use -Wno-dev to suppress it.



CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):

  Compatibility with CMake < 2.8.12 will be removed from a future version of

  CMake.



  Update the VERSION argument <min> value or use a ...<max> suffix to tell

  CMake that the project does not need compatibility with older versions.





-- Found LLVM 15.0.7

-- Using LLVMConfig.cmake in: /usr/lib/llvm-15/build/lib/cmake/llvm

LLVM STATUS:

    Definitions -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS

    Includes    /usr/lib/llvm-15/include

                /usr/lib/llvm-15/include

    Libraries   /usr/lib/llvm-15/lib

-- Configuring done

-- Generating done

-- Build files have been written to: /home/chongying/Code_generator/Angha/src/extractor/build

Input:
$ cmake --build .

Output:

[ 50%] Building CXX object FunctionExtractor/CMakeFiles/FunctionExtractor.dir/FunctionExtractor.cpp.o

/home/chongying/Code_generator/Angha/src/extractor/FunctionExtractor/FunctionExtractor.cpp: In constructor ‘WholeFileVisitor::WholeFileVisitor(clang::CompilerInstance*, llvm::StringRef)’:

/home/chongying/Code_generator/Angha/src/extractor/FunctionExtractor/FunctionExtractor.cpp:103:32: error: no match for ‘operator=’ (operand types are ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’} and ‘llvm::StringRef’)

  103 |                 _outFileName = file;

      |                                ^~~~

In file included from /usr/include/c++/11/string:55,

                 from /usr/lib/llvm-15/include/llvm/ADT/Hashing.h:54,

                 from /usr/lib/llvm-15/include/llvm/ADT/Optional.h:19,

                 from /usr/lib/llvm-15/include/llvm/Support/Casting.h:17,

                 from /usr/lib/llvm-15/include/clang/Basic/LLVM.h:21,

                 from /usr/lib/llvm-15/include/clang/Basic/DiagnosticIDs.h:17,

                 from /usr/lib/llvm-15/include/clang/Basic/Diagnostic.h:17,

                 from /usr/lib/llvm-15/include/clang/AST/NestedNameSpecifier.h:18,

                 from /usr/lib/llvm-15/include/clang/AST/Type.h:21,

                 from /usr/lib/llvm-15/include/clang/AST/CanonicalType.h:17,

                 from /usr/lib/llvm-15/include/clang/AST/ASTContext.h:19,

                 from /usr/lib/llvm-15/include/clang/AST/AST.h:17,

                 from /home/chongying/Code_generator/Angha/src/extractor/FunctionExtractor/FunctionExtractor.cpp:41:

/usr/include/c++/11/bits/basic_string.h:679:7: note: candidate: ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’

  679 |       operator=(const basic_string& __str)

      |       ^~~~~~~~

/usr/include/c++/11/bits/basic_string.h:679:37: note:   no known conversion for argument 1 from ‘llvm::StringRef’ to ‘const std::__cxx11::basic_string<char>&’

  679 |       operator=(const basic_string& __str)

      |                 ~~~~~~~~~~~~~~~~~~~~^~~~~

/usr/include/c++/11/bits/basic_string.h:689:7: note: candidate: ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’

  689 |       operator=(const _CharT* __s)

      |       ^~~~~~~~

/usr/include/c++/11/bits/basic_string.h:689:31: note:   no known conversion for argument 1 from ‘llvm::StringRef’ to ‘const char*’

  689 |       operator=(const _CharT* __s)

      |                 ~~~~~~~~~~~~~~^~~

/usr/include/c++/11/bits/basic_string.h:700:7: note: candidate: ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’

  700 |       operator=(_CharT __c)

      |       ^~~~~~~~

/usr/include/c++/11/bits/basic_string.h:700:24: note:   no known conversion for argument 1 from ‘llvm::StringRef’ to ‘char’

  700 |       operator=(_CharT __c)

      |                 ~~~~~~~^~~

/usr/include/c++/11/bits/basic_string.h:717:7: note: candidate: ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’

  717 |       operator=(basic_string&& __str)

      |       ^~~~~~~~

/usr/include/c++/11/bits/basic_string.h:717:32: note:   no known conversion for argument 1 from ‘llvm::StringRef’ to ‘std::__cxx11::basic_string<char>&&’

  717 |       operator=(basic_string&& __str)

      |                 ~~~~~~~~~~~~~~~^~~~~

/usr/include/c++/11/bits/basic_string.h:785:7: note: candidate: ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(std::initializer_list<_Tp>) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’

  785 |       operator=(initializer_list<_CharT> __l)

      |       ^~~~~~~~

/usr/include/c++/11/bits/basic_string.h:785:42: note:   no known conversion for argument 1 from ‘llvm::StringRef’ to ‘std::initializer_list<char>’

  785 |       operator=(initializer_list<_CharT> __l)

      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~^~~

/home/chongying/Code_generator/Angha/src/extractor/FunctionExtractor/FunctionExtractor.cpp: In member function ‘virtual bool FunctionVisitor::VisitFunctionDecl(clang::FunctionDecl*)’:

/home/chongying/Code_generator/Angha/src/extractor/FunctionExtractor/FunctionExtractor.cpp:189:61: error: could not convert ‘(& mng)->clang::SourceManager::getFilename(D->clang::FunctionDecl::getSourceRange().clang::SourceRange::getBegin())’ from ‘llvm::StringRef’ to ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’}

  189 |                 inputFile = validateFilename(mng.getFilename(D->getSourceRange().getBegin()));

      |                                              ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

      |                                                             |

      |                                                             llvm::StringRef

gmake[2]: *** [FunctionExtractor/CMakeFiles/FunctionExtractor.dir/build.make:76: FunctionExtractor/CMakeFiles/FunctionExtractor.dir/FunctionExtractor.cpp.o] Error 1

gmake[1]: *** [CMakeFiles/Makefile2:208: FunctionExtractor/CMakeFiles/FunctionExtractor.dir/all] Error 2

gmake: *** [Makefile:136: all] Error 2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.