mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-29 10:25:12 +00:00
switch the .ll parser into SMDiagnostic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74734 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -15,20 +15,20 @@
|
||||
#include "LLParser.h"
|
||||
#include "llvm/Module.h"
|
||||
#include "llvm/ADT/OwningPtr.h"
|
||||
#include "llvm/Support/SourceMgr.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <cstring>
|
||||
using namespace llvm;
|
||||
|
||||
Module *llvm::ParseAssemblyFile(const std::string &Filename, ParseError &Err,
|
||||
LLVMContext& Context) {
|
||||
Err.setFilename(Filename);
|
||||
|
||||
Module *llvm::ParseAssemblyFile(const std::string &Filename, SMDiagnostic &Err,
|
||||
LLVMContext &Context) {
|
||||
std::string ErrorStr;
|
||||
OwningPtr<MemoryBuffer>
|
||||
F(MemoryBuffer::getFileOrSTDIN(Filename.c_str(), &ErrorStr));
|
||||
if (F == 0) {
|
||||
Err.setError("Could not open input file '" + Filename + "'");
|
||||
Err = SMDiagnostic("", -1, -1,
|
||||
"Could not open input file '" + Filename + "'", "");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -39,9 +39,7 @@ Module *llvm::ParseAssemblyFile(const std::string &Filename, ParseError &Err,
|
||||
}
|
||||
|
||||
Module *llvm::ParseAssemblyString(const char *AsmString, Module *M,
|
||||
ParseError &Err, LLVMContext& Context) {
|
||||
Err.setFilename("<string>");
|
||||
|
||||
SMDiagnostic &Err, LLVMContext &Context) {
|
||||
OwningPtr<MemoryBuffer>
|
||||
F(MemoryBuffer::getMemBuffer(AsmString, AsmString+strlen(AsmString),
|
||||
"<string>"));
|
||||
@@ -56,33 +54,3 @@ Module *llvm::ParseAssemblyString(const char *AsmString, Module *M,
|
||||
return 0;
|
||||
return M2.take();
|
||||
}
|
||||
|
||||
|
||||
//===------------------------------------------------------------------------===
|
||||
// ParseError Class
|
||||
//===------------------------------------------------------------------------===
|
||||
|
||||
void ParseError::PrintError(const char *ProgName, raw_ostream &S) {
|
||||
errs() << ProgName << ": ";
|
||||
if (Filename == "-")
|
||||
errs() << "<stdin>";
|
||||
else
|
||||
errs() << Filename;
|
||||
|
||||
if (LineNo != -1) {
|
||||
errs() << ':' << LineNo;
|
||||
if (ColumnNo != -1)
|
||||
errs() << ':' << (ColumnNo+1);
|
||||
}
|
||||
|
||||
errs() << ": " << Message << '\n';
|
||||
|
||||
if (LineNo != -1 && ColumnNo != -1) {
|
||||
errs() << LineContents << '\n';
|
||||
|
||||
// Print out spaces/tabs before the caret.
|
||||
for (unsigned i = 0; i != unsigned(ColumnNo); ++i)
|
||||
errs() << (LineContents[i] == '\t' ? '\t' : ' ');
|
||||
errs() << "^\n";
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user