[llvm-commits] [llvm] r147501 - in /llvm/trunk: include/llvm/LLVMContext.h lib/VMCore/LLVMContext.cpp

Chris Lattner sabre at nondot.org
Tue Jan 3 15:47:06 PST 2012


Author: lattner
Date: Tue Jan  3 17:47:05 2012
New Revision: 147501

URL: http://llvm.org/viewvc/llvm-project?rev=147501&view=rev
Log:
generalize LLVMContext::emitError to take a twine instead of a StringRef.

Modified:
    llvm/trunk/include/llvm/LLVMContext.h
    llvm/trunk/lib/VMCore/LLVMContext.cpp

Modified: llvm/trunk/include/llvm/LLVMContext.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LLVMContext.h?rev=147501&r1=147500&r2=147501&view=diff
==============================================================================
--- llvm/trunk/include/llvm/LLVMContext.h (original)
+++ llvm/trunk/include/llvm/LLVMContext.h Tue Jan  3 17:47:05 2012
@@ -19,6 +19,7 @@
 
 class LLVMContextImpl;
 class StringRef;
+class Twine;
 class Instruction;
 class Module;
 class SMDiagnostic;
@@ -80,9 +81,9 @@
   /// 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

Modified: llvm/trunk/lib/VMCore/LLVMContext.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContext.cpp?rev=147501&r1=147500&r2=147501&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/LLVMContext.cpp (original)
+++ llvm/trunk/lib/VMCore/LLVMContext.cpp Tue Jan  3 17:47:05 2012
@@ -83,11 +83,11 @@
   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 @@
   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";





More information about the llvm-commits mailing list