llvm.org GIT mirror llvm / 3a4c60c
generalize LLVMContext::emitError to take a twine instead of a StringRef. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147501 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 8 years ago
2 changed file(s) with 7 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
1818
1919 class LLVMContextImpl;
2020 class StringRef;
21 class Twine;
2122 class Instruction;
2223 class Module;
2324 class SMDiagnostic;
7980 /// be prepared to drop the erroneous construct on the floor and "not crash".
8081 /// The generated code need not be correct. The error message will be
8182 /// implicitly prefixed with "error: " and should not end with a ".".
82 void emitError(unsigned LocCookie, StringRef ErrorStr);
83 void emitError(const Instruction *I, StringRef ErrorStr);
84 void emitError(StringRef ErrorStr);
83 void emitError(unsigned LocCookie, const Twine &ErrorStr);
84 void emitError(const Instruction *I, const Twine &ErrorStr);
85 void emitError(const Twine &ErrorStr);
8586
8687 private:
8788 // DO NOT IMPLEMENT
8282 return pImpl->InlineAsmDiagContext;
8383 }
8484
85 void LLVMContext::emitError(StringRef ErrorStr) {
85 void LLVMContext::emitError(const Twine &ErrorStr) {
8686 emitError(0U, ErrorStr);
8787 }
8888
89 void LLVMContext::emitError(const Instruction *I, StringRef ErrorStr) {
89 void LLVMContext::emitError(const Instruction *I, const Twine &ErrorStr) {
9090 unsigned LocCookie = 0;
9191 if (const MDNode *SrcLoc = I->getMetadata("srcloc")) {
9292 if (SrcLoc->getNumOperands() != 0)
9696 return emitError(LocCookie, ErrorStr);
9797 }
9898
99 void LLVMContext::emitError(unsigned LocCookie, StringRef ErrorStr) {
99 void LLVMContext::emitError(unsigned LocCookie, const Twine &ErrorStr) {
100100 // If there is no error handler installed, just print the error and exit.
101101 if (pImpl->InlineAsmDiagHandler == 0) {
102102 errs() << "error: " << ErrorStr << "\n";