From 26a8953060c9e3526ce18c1fc29e64383d02c13f Mon Sep 17 00:00:00 2001 From: apio Date: Fri, 26 Aug 2022 18:18:34 +0200 Subject: [PATCH] Prevent generateASTNode from overwriting a file if it already exists --- tools/generateASTNode.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/generateASTNode.sh b/tools/generateASTNode.sh index 5b5230f..66af576 100755 --- a/tools/generateASTNode.sh +++ b/tools/generateASTNode.sh @@ -5,6 +5,14 @@ if [ "$1" == "" ]; then exit 1 fi +if [ -f $1.cpp ]; then +exit 0 +fi + +if [ -f $1.h ]; then +exit 0 +fi + touch $1.cpp touch $1.h @@ -39,4 +47,4 @@ llvm::Value* $1::codegen(IRBuilder* generator) return llvm::ConstantInt::getSigned(llvm::IntegerType::getInt32Ty(generator->getBuilder()->getContext()), 0); } -EOF \ No newline at end of file +EOF