9
9
10
10
#include " BinaryHolder.h"
11
11
#include " DebugMap.h"
12
- #include " ErrorReporting.h"
13
12
#include " MachOUtils.h"
14
13
#include " NonRelocatableStringpool.h"
15
14
#include " dsymutil.h"
79
78
#include " llvm/Support/TargetRegistry.h"
80
79
#include " llvm/Support/ThreadPool.h"
81
80
#include " llvm/Support/ToolOutputFile.h"
81
+ #include " llvm/Support/WithColor.h"
82
82
#include " llvm/Support/raw_ostream.h"
83
83
#include " llvm/Target/TargetMachine.h"
84
84
#include " llvm/Target/TargetOptions.h"
@@ -587,15 +587,15 @@ static bool inFunctionScope(CompileUnit &U, unsigned Idx) {
587
587
} // namespace
588
588
589
589
void warn (Twine Warning, Twine Context) {
590
- warn_ostream () << Warning + " \n " ;
590
+ WithColor::warning () << Warning + " \n " ;
591
591
if (!Context.isTriviallyEmpty ())
592
- note_ostream () << Twine (" while processing " ) + Context + " \n " ;
592
+ WithColor::note () << Twine (" while processing " ) + Context + " \n " ;
593
593
}
594
594
595
595
bool error (Twine Error, Twine Context) {
596
- error_ostream () << Error + " \n " ;
596
+ WithColor::error () << Error + " \n " ;
597
597
if (!Context.isTriviallyEmpty ())
598
- note_ostream () << Twine (" while processing " ) + Context + " \n " ;
598
+ WithColor::note () << Twine (" while processing " ) + Context + " \n " ;
599
599
return false ;
600
600
}
601
601
@@ -2178,7 +2178,7 @@ void DwarfLinker::reportWarning(const Twine &Warning, const DebugMapObject &DMO,
2178
2178
DumpOpts.RecurseDepth = 0 ;
2179
2179
DumpOpts.Verbose = Options.Verbose ;
2180
2180
2181
- note_ostream () << " in DIE:\n " ;
2181
+ WithColor::note () << " in DIE:\n " ;
2182
2182
DIE->dump (errs (), 6 /* Indent */ , DumpOpts);
2183
2183
}
2184
2184
@@ -3999,9 +3999,9 @@ Error DwarfLinker::loadClangModule(StringRef Filename, StringRef ModulePath,
3999
3999
// cache has expired and was pruned by clang. A more adventurous
4000
4000
// dsymutil would invoke clang to rebuild the module now.
4001
4001
if (!ModuleCacheHintDisplayed) {
4002
- note_ostream () << " The clang module cache may have expired since "
4003
- " this object file was built. Rebuilding the "
4004
- " object file will rebuild the module cache.\n " ;
4002
+ WithColor::note () << " The clang module cache may have expired since "
4003
+ " this object file was built. Rebuilding the "
4004
+ " object file will rebuild the module cache.\n " ;
4005
4005
ModuleCacheHintDisplayed = true ;
4006
4006
}
4007
4007
} else if (isArchive) {
@@ -4010,12 +4010,13 @@ Error DwarfLinker::loadClangModule(StringRef Filename, StringRef ModulePath,
4010
4010
// was built on a different machine. We don't want to discourage module
4011
4011
// debugging for convenience libraries within a project though.
4012
4012
if (!ArchiveHintDisplayed) {
4013
- note_ostream () << " Linking a static library that was built with "
4014
- " -gmodules, but the module cache was not found. "
4015
- " Redistributable static libraries should never be "
4016
- " built with module debugging enabled. The debug "
4017
- " experience will be degraded due to incomplete "
4018
- " debug information.\n " ;
4013
+ WithColor::note ()
4014
+ << " Linking a static library that was built with "
4015
+ " -gmodules, but the module cache was not found. "
4016
+ " Redistributable static libraries should never be "
4017
+ " built with module debugging enabled. The debug "
4018
+ " experience will be degraded due to incomplete "
4019
+ " debug information.\n " ;
4019
4020
ArchiveHintDisplayed = true ;
4020
4021
}
4021
4022
}
@@ -4248,10 +4249,10 @@ bool DwarfLinker::link(const DebugMap &Map) {
4248
4249
Stat.getLastModificationTime () !=
4249
4250
sys::TimePoint<>(LinkContext.DMO .getTimestamp ())) {
4250
4251
// Not using the helper here as we can easily stream TimePoint<>.
4251
- warn_ostream () << " Timestamp mismatch for " << File << " : "
4252
- << Stat. getLastModificationTime () << " and "
4253
- << sys::TimePoint<>(LinkContext. DMO . getTimestamp ())
4254
- << " \n " ;
4252
+ WithColor::warning ()
4253
+ << " Timestamp mismatch for " << File << " : "
4254
+ << Stat. getLastModificationTime () << " and "
4255
+ << sys::TimePoint<>(LinkContext. DMO . getTimestamp ()) << " \n " ;
4255
4256
continue ;
4256
4257
}
4257
4258
0 commit comments