Skip to content
Browse files

Work inefficiently. :(

  • Loading branch information...
1 parent 4fbc239 commit 481e19c91653bbbcb081e099db48f75cd6760199 Nowar committed Feb 12, 2011
Showing with 14 additions and 43 deletions.
  1. +2 −4 Makefile
  2. +0 −36 include/Usage.hpp
  3. +5 −3 tools/demo.cpp → src/main.cpp
  4. +7 −0 tests/test.sh
View
6 Makefile
@@ -18,9 +18,7 @@ define warnDebugVersion
@echo "*******************"
endef
-header_files := include/Usage.hpp
-
-src_files := tools/demo.cpp
+src_files := src/main.cpp
all_files := $(header_files) $(src_files) Makefile
@@ -35,4 +33,4 @@ endif
clean:
- rm -f out/*
+ rm -rf out/
View
36 include/Usage.hpp
@@ -1,36 +0,0 @@
-// Copyright (C) 2011 Nowar
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#ifndef USAGE_HPP
-#define USAGE_HPP
-
-namespace llvm {
-class raw_ostream;
-} // namespace llvm
-
-class Usage {
- public:
- static void showUsage(llvm::raw_ostream& os, const char* progName) {
- os << "Usage: " << progName << " LLVM-IR-file\n";
- os << "\n";
- os << progName << " is a trivial JIT-Compiler using LLVM.\n";
- os << "It reads LLVM module from the input argument, creates a JIT-Compiler, and runs on 'main' function.\n";
- os << "Note: We assume 'main' needs no arguments.\n";
- }
- private:
- Usage();
-};
-
-#endif
View
8 tools/demo.cpp → src/main.cpp
@@ -22,11 +22,13 @@
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetSelect.h"
-#include "Usage.hpp"
-
int main(int argc, char** argv) {
if (argc != 2) {
- Usage::showUsage(llvm::outs(), argv[0]);
+ llvm::raw_ostream& os = llvm::outs();
+ os << "Usage: " << argv[0] << " LLVM-IR-file\n";
+ os << argv[0] << " is a trivial JIT-Compiler using LLVM.\n";
+ os << "It reads LLVM module from the input argument, creates a JIT-Compiler, and runs on 'main' function.\n";
+ os << "Note: We assume 'main' needs no arguments.\n";
return 1;
}
View
7 tests/test.sh
@@ -19,11 +19,18 @@ if [ -d $1 ]; then
out_diff=$(echo $?)
$(diff $src_dir/stderr $src_dir/stderr.expect > /dev/null 2> /dev/null)
err_diff=$(echo $?)
+
+ hasErr=0
if [ $out_diff -ne 0 ]; then
echo "Error: stdout is not correct."
+ hasErr=1
fi
if [ $err_diff -ne 0 ]; then
echo "Error: stderr is not correct."
+ hasErr=1
+ fi
+ if [ $hasErr -eq 0 ]; then
+ echo "No error."
fi
else
showUsage

0 comments on commit 481e19c

Please sign in to comment.
Something went wrong with that request. Please try again.