[llvm] r230820 - [dsymutil] Create warn() global helper...

Frederic Riss friss at apple.com
Fri Feb 27 16:29:01 PST 2015


Author: friss
Date: Fri Feb 27 18:29:01 2015
New Revision: 230820

URL: http://llvm.org/viewvc/llvm-project?rev=230820&view=rev
Log:
[dsymutil] Create warn() global helper...

...and reimplement DwarfLinker::reportWarning in terms of it. Other
compenents than the DwarfLinker will need to report warnings, and I'm
about to add a similar "error()" helper at the same global level so
make that consistent.

Modified:
    llvm/trunk/tools/dsymutil/DwarfLinker.cpp

Modified: llvm/trunk/tools/dsymutil/DwarfLinker.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/DwarfLinker.cpp?rev=230820&r1=230819&r2=230820&view=diff
==============================================================================
--- llvm/trunk/tools/dsymutil/DwarfLinker.cpp (original)
+++ llvm/trunk/tools/dsymutil/DwarfLinker.cpp Fri Feb 27 18:29:01 2015
@@ -23,6 +23,11 @@ namespace dsymutil {
 
 namespace {
 
+void warn(const Twine &Warning, const Twine &Context) {
+  errs() << Twine("while processing ") + Context + ":\n";
+  errs() << Twine("warning: ") + Warning + "\n";
+}
+
 /// \brief Stores all information relating to a compile unit, be it in
 /// its original instance in the object file to its brand new cloned
 /// and linked DIE tree.
@@ -219,10 +224,10 @@ const DWARFDebugInfoEntryMinimal *DwarfL
 /// information about a specific \p DIE related to the warning.
 void DwarfLinker::reportWarning(const Twine &Warning, const DWARFUnit *Unit,
                                 const DWARFDebugInfoEntryMinimal *DIE) {
+  StringRef Context = "<debug map>";
   if (CurrentDebugObject)
-    errs() << Twine("while processing ") +
-                  CurrentDebugObject->getObjectFilename() + ":\n";
-  errs() << Twine("warning: ") + Warning + "\n";
+    Context = CurrentDebugObject->getObjectFilename();
+  warn(Warning, Context);
 
   if (!Verbose || !DIE)
     return;





More information about the llvm-commits mailing list