llvm-project/lldb/source/Core
Raphael Isemann eca9ce14d6 Disable use-color if the output stream is not a terminal with color support.
Summary:
LLDB currently only checks the output terminal for color support by looking
at the `TERM` environment variable and comparing it to `"dumb"`. This causes that
when running LLDB on a CI node, the syntax highlighter will not be deactivated by
LLDB and the output log is filled with color codes (unless the terminal emulator
actually exposes itself as dumb).

This patch now relies on the LLVM code for detecting color support which is more
reliable. We now also correctly actually initialize the `m_supports_colors` variable in `File`.
`m_supports_colors` was so far uninitialized, but the code path that uses `m_supports_colors`
was also dead so the sanitizers didn't sound an alarm.

The old check that compares `TERM` is not removed by this patch as the new LLVM code
doesn't seem to handle this case (and it's a good thing to check for "dumb" terminals).

Reviewers: aprantl, javed.absar

Reviewed By: aprantl

Subscribers: kristof.beyls, abidh, lldb-commits

Differential Revision: https://reviews.llvm.org/D51243

llvm-svn: 340747
2018-08-27 15:16:25 +00:00
..
Address.cpp Change AddressClass type from 'enum' to 'enum class'. 2018-06-26 13:06:54 +00:00
AddressRange.cpp Move ArchSpec to the Utility module 2017-11-13 16:16:33 +00:00
AddressResolver.cpp iwyu fixes for lldbCore. 2017-04-06 21:28:29 +00:00
AddressResolverFileLine.cpp iwyu fixes for lldbCore. 2017-04-06 21:28:29 +00:00
AddressResolverName.cpp Reflow paragraphs in comments. 2018-04-30 16:49:04 +00:00
Broadcaster.cpp Reflow paragraphs in comments. 2018-04-30 16:49:04 +00:00
CMakeLists.txt Use rich mangling information in Symtab::InitNameIndexes() 2018-08-08 21:57:37 +00:00
Communication.cpp Typo fixes. 2018-05-29 09:10:46 +00:00
Debugger.cpp Disable use-color if the output stream is not a terminal with color support. 2018-08-27 15:16:25 +00:00
Disassembler.cpp Change AddressClass type from 'enum' to 'enum class'. 2018-06-26 13:06:54 +00:00
DumpDataExtractor.cpp Reflow paragraphs in comments. 2018-04-30 16:49:04 +00:00
DumpRegisterValue.cpp Move RegisterValue,Scalar,State from Core to Utility 2018-08-07 11:07:21 +00:00
DynamicLoader.cpp Reflow paragraphs in comments. 2018-04-30 16:49:04 +00:00
EmulateInstruction.cpp Move RegisterValue,Scalar,State from Core to Utility 2018-08-07 11:07:21 +00:00
Event.cpp Reimplement EventDataBytes::Dump to avoid DumpDataExtractor 2018-07-24 10:49:14 +00:00
FileLineResolver.cpp Reflow paragraphs in comments. 2018-04-30 16:49:04 +00:00
FileSpecList.cpp Reflow paragraphs in comments. 2018-04-30 16:49:04 +00:00
FormatEntity.cpp Move RegisterValue,Scalar,State from Core to Utility 2018-08-07 11:07:21 +00:00
Highlighter.cpp Remove manual byte counting from Highlighter code. 2018-08-14 17:12:54 +00:00
IOHandler.cpp Move RegisterValue,Scalar,State from Core to Utility 2018-08-07 11:07:21 +00:00
Listener.cpp Reflow paragraphs in comments. 2018-04-30 16:49:04 +00:00
Mangled.cpp RichManglingContext: Make m_ipd_str_len a local variable and simplify processIPDStrResult + polishing in test and Mangled 2018-08-10 15:21:33 +00:00
Module.cpp Use a DenseMap for looking up functions by UID in CompileUnit::FindFunctionByUID 2018-08-11 23:40:27 +00:00
ModuleChild.cpp *** This commit represents a complete reformatting of the LLDB source code 2016-09-06 20:57:50 +00:00
ModuleList.cpp Remove append parameter to FindGlobalVariables 2018-05-31 09:46:26 +00:00
Opcode.cpp Remove manual byte counting from Opcode::Dump 2018-08-20 15:51:14 +00:00
PluginManager.cpp Replace HostInfo::GetLLDBPath with specific functions 2018-06-19 15:09:07 +00:00
RichManglingContext.cpp RichManglingContext: Make m_ipd_str_len a local variable and simplify processIPDStrResult + polishing in test and Mangled 2018-08-10 15:21:33 +00:00
SearchFilter.cpp Update StructuredData::String to return StringRefs. 2017-05-12 05:49:54 +00:00
Section.cpp Add .debug_names section glue code 2018-06-01 12:06:45 +00:00
SourceManager.cpp Remove manual byte counting from Highlighter code. 2018-08-14 17:12:54 +00:00
StreamAsynchronousIO.cpp Add byte counting mechanism to LLDB's Stream class. 2018-08-02 16:38:34 +00:00
StreamFile.cpp Add byte counting mechanism to LLDB's Stream class. 2018-08-02 16:38:34 +00:00
UserSettingsController.cpp Rename Error -> Status. 2017-05-12 04:51:55 +00:00
Value.cpp Move RegisterValue,Scalar,State from Core to Utility 2018-08-07 11:07:21 +00:00
ValueObject.cpp Move RegisterValue,Scalar,State from Core to Utility 2018-08-07 11:07:21 +00:00
ValueObjectCast.cpp Move RegisterValue,Scalar,State from Core to Utility 2018-08-07 11:07:21 +00:00
ValueObjectChild.cpp Move RegisterValue,Scalar,State from Core to Utility 2018-08-07 11:07:21 +00:00
ValueObjectConstResult.cpp Move RegisterValue,Scalar,State from Core to Utility 2018-08-07 11:07:21 +00:00
ValueObjectConstResultCast.cpp Rename Error -> Status. 2017-05-12 04:51:55 +00:00
ValueObjectConstResultChild.cpp Rename Error -> Status. 2017-05-12 04:51:55 +00:00
ValueObjectConstResultImpl.cpp Move RegisterValue,Scalar,State from Core to Utility 2018-08-07 11:07:21 +00:00
ValueObjectDynamicValue.cpp Move RegisterValue,Scalar,State from Core to Utility 2018-08-07 11:07:21 +00:00
ValueObjectList.cpp Reflow paragraphs in comments. 2018-04-30 16:49:04 +00:00
ValueObjectMemory.cpp Move RegisterValue,Scalar,State from Core to Utility 2018-08-07 11:07:21 +00:00
ValueObjectRegister.cpp Move RegisterValue,Scalar,State from Core to Utility 2018-08-07 11:07:21 +00:00
ValueObjectSyntheticFilter.cpp Fix the libcxx set, multiset, vector and bitset formatters to work on references. 2018-07-13 19:28:32 +00:00
ValueObjectVariable.cpp Move RegisterValue,Scalar,State from Core to Utility 2018-08-07 11:07:21 +00:00