1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00
llvm-mirror/lib/Support
Graydon Hoare 24302d51b0 [YAML] Escape non-printable multibyte UTF8 in Output::scalarString.
The existing YAML Output::scalarString code path includes a partial and
incorrect implementation of YAML escaping logic. In particular, the logic put
in place in rL321283 escapes non-printable bytes only if they are not part of a
multibyte UTF8 sequence; implicitly this means that all multibyte UTF8
sequences -- printable and non -- are passed through verbatim.

The simplest solution to this is to direct the Output::scalarString method to
use the standalone yaml::escape function, and this _almost_ works, except that
the existing code in that function _over_ escapes: any multibyte UTF8 sequence
is escaped, even printable ones. While this is permitted for YAML, it is also
more aggressive (and hard to read for non-English locales) than necessary,
and the entire point of rL321283 was to back off such aggressive over-escaping.

So in this change, I have both redirected Output::scalarString to use
yaml::escape _and_ modified yaml::escape to optionally restrict its escaping to
non-printables. This preserves behaviour of any existing clients while giving
them a path to more moderate escaping should they desire.

Reviewers: JDevlieghere, thegameg, MatzeB, vladimir.plyashkun

Reviewed By: thegameg

Subscribers: llvm-commits

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

llvm-svn: 328661
2018-03-27 19:52:45 +00:00
..
Unix [Support] Add WriteThroughMemoryBuffer. 2018-03-08 20:34:47 +00:00
Windows [Support] Add WriteThroughMemoryBuffer. 2018-03-08 20:34:47 +00:00
Allocator.cpp
AMDGPUMetadata.cpp
APFloat.cpp
APInt.cpp [ADT] Simplify getMemory. NFC 2018-03-23 17:26:12 +00:00
APSInt.cpp
ARMAttributeParser.cpp Test commit 2018-02-26 13:05:18 +00:00
ARMBuildAttrs.cpp
ARMWinEH.cpp
Atomic.cpp
BinaryStreamError.cpp
BinaryStreamReader.cpp
BinaryStreamRef.cpp
BinaryStreamWriter.cpp
BlockFrequency.cpp
BranchProbability.cpp
CachePruning.cpp
Chrono.cpp
circular_raw_ostream.cpp
CMakeLists.txt [Support] Move syntax highlighting into support 2018-03-09 09:56:24 +00:00
CodeGenCoverage.cpp
COM.cpp
CommandLine.cpp On Windows we need to be able to process response files with Windows-style 2018-03-05 19:34:33 +00:00
Compression.cpp
ConvertUTF.cpp
ConvertUTFWrapper.cpp
COPYRIGHT.regex
CrashRecoveryContext.cpp
DAGDeltaAlgorithm.cpp
DataExtractor.cpp
Debug.cpp
DebugCounter.cpp
DeltaAlgorithm.cpp
DJB.cpp Make llvm::djbHash an inline function. 2018-03-02 22:00:38 +00:00
DynamicLibrary.cpp
Errno.cpp
Error.cpp
ErrorHandling.cpp Report fatal error in the case of out of memory 2018-02-17 10:21:33 +00:00
FileOutputBuffer.cpp
FileUtilities.cpp
FoldingSet.cpp Revert r325224 "Report fatal error in the case of out of memory" 2018-02-15 09:45:59 +00:00
FormattedStream.cpp
FormatVariadic.cpp
GlobPattern.cpp
GraphWriter.cpp
Hashing.cpp
Host.cpp [Support] Stop passing StringRefs by const reference in some of the getHostCPUname implementations. NFC 2018-03-07 17:53:16 +00:00
IntEqClasses.cpp
IntervalMap.cpp
JamCRC.cpp
KnownBits.cpp
LEB128.cpp
LineIterator.cpp
LLVMBuild.txt
Locale.cpp
LockFileManager.cpp [Support] Replace hand-written scope_exit with make_scope_exit. 2018-02-18 16:05:40 +00:00
LowLevelType.cpp
ManagedStatic.cpp
MathExtras.cpp
MD5.cpp
Memory.cpp
MemoryBuffer.cpp Fix signed-unsigned comparison warning. 2018-03-08 20:57:37 +00:00
Mutex.cpp
NativeFormatting.cpp
Options.cpp
Parallel.cpp
Path.cpp Changed createTemporaryFile without FD to actually create a file. 2018-03-19 14:19:58 +00:00
PluginLoader.cpp
PrettyStackTrace.cpp
Process.cpp
Program.cpp
RandomNumberGenerator.cpp
raw_os_ostream.cpp
raw_ostream.cpp
README.txt.system
regcomp.c
regengine.inc
regerror.c
regex2.h
regex_impl.h
Regex.cpp Fix compilation on Darwin with expensive checks. 2018-03-12 11:01:05 +00:00
regexec.c
regfree.c
regstrlcpy.c
regutils.h
RWMutex.cpp Report fatal error in the case of out of memory 2018-02-20 05:41:26 +00:00
ScaledNumber.cpp
ScopedPrinter.cpp
SHA1.cpp Fix header comment on SHA1 code. 2018-03-09 00:23:35 +00:00
Signals.cpp
SmallPtrSet.cpp
SmallVector.cpp
SourceMgr.cpp
SpecialCaseList.cpp
Statistic.cpp Support resetting STATISTIC() values using llvm::ResetStatistics() 2018-03-08 02:36:25 +00:00
StringExtras.cpp
StringMap.cpp Re-land: "[Support] Replace HashString with djbHash." 2018-02-26 15:16:42 +00:00
StringPool.cpp
StringRef.cpp
StringSaver.cpp
SystemUtils.cpp
TargetParser.cpp
TargetRegistry.cpp
TarWriter.cpp
Threading.cpp
ThreadLocal.cpp
ThreadPool.cpp
Timer.cpp
ToolOutputFile.cpp
TrigramIndex.cpp
Triple.cpp [AMDGPU] Remove use of OpenCL triple environment and replace with function attribute for AMDGPU 2018-03-23 18:45:18 +00:00
Twine.cpp
Unicode.cpp
UnicodeCaseFold.cpp Resubmit r325107 (case folding DJB hash) 2018-02-21 22:36:31 +00:00
Valgrind.cpp
Watchdog.cpp
WithColor.cpp [Support] Move syntax highlighting into support 2018-03-09 09:56:24 +00:00
xxhash.cpp
YAMLParser.cpp [YAML] Escape non-printable multibyte UTF8 in Output::scalarString. 2018-03-27 19:52:45 +00:00
YAMLTraits.cpp [YAML] Escape non-printable multibyte UTF8 in Output::scalarString. 2018-03-27 19:52:45 +00:00

Design Of lib/System
====================

The software in this directory is designed to completely shield LLVM from any
and all operating system specific functionality. It is not intended to be a
complete operating system wrapper (such as ACE), but only to provide the
functionality necessary to support LLVM.

The software located here, of necessity, has very specific and stringent design
rules. Violation of these rules means that cracks in the shield could form and
the primary goal of the library is defeated. By consistently using this library,
LLVM becomes more easily ported to new platforms since the only thing requiring
porting is this library.

Complete documentation for the library can be found in the file:
  llvm/docs/SystemLibrary.html
or at this URL:
  http://llvm.org/docs/SystemLibrary.html

While we recommend that you read the more detailed documentation, for the
impatient, here's a high level summary of the library's requirements.

 1. No system header files are to be exposed through the interface.
 2. Std C++ and Std C header files are okay to be exposed through the interface.
 3. No exposed system-specific functions.
 4. No exposed system-specific data.
 5. Data in lib/System classes must use only simple C++ intrinsic types.
 6. Errors are handled by returning "true" and setting an optional std::string
 7. Library must not throw any exceptions, period.
 8. Interface functions must not have throw() specifications.
 9. No duplicate function impementations are permitted within an operating
    system class.

To accomplish these requirements, the library has numerous design criteria that
must be satisfied. Here's a high level summary of the library's design criteria:

 1. No unused functionality (only what LLVM needs)
 2. High-Level Interfaces
 3. Use Opaque Classes
 4. Common Implementations
 5. Multiple Implementations
 6. Minimize Memory Allocation
 7. No Virtual Methods