SourceMgr: Use has_colors() instead of just is_displayed() before trying to use
authorDaniel Dunbar <daniel@zuster.org>
Fri, 20 Jul 2012 18:29:44 +0000 (18:29 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Fri, 20 Jul 2012 18:29:44 +0000 (18:29 +0000)
color.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160559 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/SourceMgr.cpp

index 37a9d8f82744ae381f3e4d0975f05454b1529ed8..e4e01be0380291848330485f04318340d4799ac3 100644 (file)
@@ -243,8 +243,8 @@ SMDiagnostic::SMDiagnostic(const SourceMgr &sm, SMLoc L, const std::string &FN,
 
 void SMDiagnostic::print(const char *ProgName, raw_ostream &S,
                          bool ShowColors) const {
-  // Display colors only if OS goes to a tty.
-  ShowColors &= S.is_displayed();
+  // Display colors only if OS supports colors.
+  ShowColors &= S.has_colors();
 
   if (ShowColors)
     S.changeColor(raw_ostream::SAVEDCOLOR, true);