From cd0989d06081c14049ca5f438c9435e7620dbace Mon Sep 17 00:00:00 2001 From: Sameer Rahmani Date: Sun, 21 Mar 2021 16:25:12 +0000 Subject: [PATCH] Update the builder and CMakefile to get ready for LLVM 13 --- CMakeLists.txt | 2 +- bin/serene.cpp | 24 +++++++++++++++++++++--- builder | 17 ++++++++--------- 3 files changed, 30 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fe0f8f7..2816408 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,7 +20,7 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) set(BIN_DIR ${CMAKE_SOURCE_DIR}/bin) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror") - set(CMAKE_CXX_CLANG_TIDY clang-tidy-10) + set(CMAKE_CXX_CLANG_TIDY clang-tidy) # Let's ensure -std=c++xx instead of -std=g++xx set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_FLAGS_DEBUG diff --git a/bin/serene.cpp b/bin/serene.cpp index 4f6550b..ea83d41 100644 --- a/bin/serene.cpp +++ b/bin/serene.cpp @@ -25,14 +25,32 @@ #include "serene/serene.hpp" #include "serene/compiler.hpp" #include +#include using namespace std; using namespace serene; -int main(int argc, char *argv[]) { - UNUSED(argc); - cout << "Serene >>" << endl; +namespace cl = llvm::cl; +namespace { +enum Action { None, DumpAST } +} + +static cl::opt + emitAction("emit", cl::desc("Select what to dump."), + cl::values(clEnumValN(DumpAST, "ast", "Output the AST only"))); + + + +int main(int argc, char *argv[]) { + cl::ParseCommandLineOptions(argc, argv, "Serene compiler \n"); + + + switch (emitAction) { + case Action::DumpAST: + Reader r = Reader(input); + r->dump(); + } string input_file(argv[1]); Compiler c; diff --git a/builder b/builder index fa0371c..0f7fb35 100755 --- a/builder +++ b/builder @@ -3,10 +3,10 @@ command=$1 -export CCC_CC=clang-11 -export CCC_CXX=clang++-11 -export CC=clang-11 -export CXX=clang++-11 +export CCC_CC=clang +export CCC_CXX=clang++ +export CC=clang +export CXX=clang++ ROOT_DIR=`pwd` BUILD_DIR=$ROOT_DIR/build @@ -65,12 +65,11 @@ function tests() { case "$command" in + # We need to fix this to have some instructions about how to build the dependencies "deps") - sudo apt update - sudo apt install -y llvm-10 llvm-10-tools \ - clang-10 clang-format-10 clang-tidy-10 \ - clang-tools-10 valgrind cmake ninja-build \ - doxygen + echo "You need the following dependencies" + echo "sudo apt update" + echo "sudo apt install -y llvm-10 llvm-10-tools clang-10 clang-format-10 clang-tidy-10 clang-tools-10 valgrind cmake ninja-build doxygen" ;; "setup") pushd ./scripts