1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

generalize LLVMContext::emitError to take a twine instead of a StringRef.

llvm-svn: 147501
This commit is contained in:
Chris Lattner 2012-01-03 23:47:05 +00:00
parent 74a3944974
commit 4f5ba31205
2 changed files with 7 additions and 6 deletions

View File

@ -19,6 +19,7 @@ namespace llvm {
class LLVMContextImpl;
class StringRef;
class Twine;
class Instruction;
class Module;
class SMDiagnostic;
@ -80,9 +81,9 @@ public:
/// be prepared to drop the erroneous construct on the floor and "not crash".
/// The generated code need not be correct. The error message will be
/// implicitly prefixed with "error: " and should not end with a ".".
void emitError(unsigned LocCookie, StringRef ErrorStr);
void emitError(const Instruction *I, StringRef ErrorStr);
void emitError(StringRef ErrorStr);
void emitError(unsigned LocCookie, const Twine &ErrorStr);
void emitError(const Instruction *I, const Twine &ErrorStr);
void emitError(const Twine &ErrorStr);
private:
// DO NOT IMPLEMENT

View File

@ -83,11 +83,11 @@ void *LLVMContext::getInlineAsmDiagnosticContext() const {
return pImpl->InlineAsmDiagContext;
}
void LLVMContext::emitError(StringRef ErrorStr) {
void LLVMContext::emitError(const Twine &ErrorStr) {
emitError(0U, ErrorStr);
}
void LLVMContext::emitError(const Instruction *I, StringRef ErrorStr) {
void LLVMContext::emitError(const Instruction *I, const Twine &ErrorStr) {
unsigned LocCookie = 0;
if (const MDNode *SrcLoc = I->getMetadata("srcloc")) {
if (SrcLoc->getNumOperands() != 0)
@ -97,7 +97,7 @@ void LLVMContext::emitError(const Instruction *I, StringRef ErrorStr) {
return emitError(LocCookie, ErrorStr);
}
void LLVMContext::emitError(unsigned LocCookie, StringRef ErrorStr) {
void LLVMContext::emitError(unsigned LocCookie, const Twine &ErrorStr) {
// If there is no error handler installed, just print the error and exit.
if (pImpl->InlineAsmDiagHandler == 0) {
errs() << "error: " << ErrorStr << "\n";