From 1acbea1678087e5d789acfc6fce094efa818d182 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 30 Aug 2002 22:54:41 +0000 Subject: - 'analyze' and 'as' now explicitly verify input because AsmParser doesn't. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3552 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/llvm-as/as.cpp | 7 +++++++ tools/llvm-as/llvm-as.cpp | 7 +++++++ 2 files changed, 14 insertions(+) (limited to 'tools/llvm-as') diff --git a/tools/llvm-as/as.cpp b/tools/llvm-as/as.cpp index 7593cef..c9bd3b4 100644 --- a/tools/llvm-as/as.cpp +++ b/tools/llvm-as/as.cpp @@ -12,6 +12,7 @@ #include "llvm/Module.h" #include "llvm/Assembly/Parser.h" #include "llvm/Bytecode/Writer.h" +#include "llvm/Analysis/Verifier.h" #include "Support/CommandLine.h" #include "Support/Signals.h" #include @@ -43,6 +44,12 @@ int main(int argc, char **argv) { cerr << argv[0] << ": assembly didn't read correctly.\n"; return 1; } + + if (verifyModule(*M.get())) { + cerr << argv[0] << ": assembly parsed, but does not verify as correct!\n"; + return 1; + } + if (DumpAsm) cerr << "Here's the assembly:\n" << M.get(); diff --git a/tools/llvm-as/llvm-as.cpp b/tools/llvm-as/llvm-as.cpp index 7593cef..c9bd3b4 100644 --- a/tools/llvm-as/llvm-as.cpp +++ b/tools/llvm-as/llvm-as.cpp @@ -12,6 +12,7 @@ #include "llvm/Module.h" #include "llvm/Assembly/Parser.h" #include "llvm/Bytecode/Writer.h" +#include "llvm/Analysis/Verifier.h" #include "Support/CommandLine.h" #include "Support/Signals.h" #include @@ -43,6 +44,12 @@ int main(int argc, char **argv) { cerr << argv[0] << ": assembly didn't read correctly.\n"; return 1; } + + if (verifyModule(*M.get())) { + cerr << argv[0] << ": assembly parsed, but does not verify as correct!\n"; + return 1; + } + if (DumpAsm) cerr << "Here's the assembly:\n" << M.get(); -- cgit v1.1