llvm/lib/Support
Richard Smith 638ba5afb5 Fix ODR violations due to abuse of LLVM_YAML_IS_(FLOW_)?SEQUENCE_VECTOR
This is a short-term fix for PR33650 aimed to get the modules build bots green again.

Remove all the places where we use the LLVM_YAML_IS_(FLOW_)?SEQUENCE_VECTOR
macros to try to locally specialize a global template for a global type. That's
not how C++ works.

Instead, we now centrally define how to format vectors of fundamental types and
of string (std::string and StringRef). We use flow formatting for the former
cases, since that's the obvious right thing to do; in the latter case, it's
less clear what the right choice is, but flow formatting is really bad for some
cases (due to very long strings), so we pick block formatting. (Many of the
cases that were using flow formatting for strings are improved by this change.)

Other than the flow -> block formatting change for some vectors of strings,
this should result in no functionality change.

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

Corresponding updates to clang, clang-tools-extra, and lld to follow.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306878 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-30 20:56:57 +00:00
..
Unix Recommit "[Support] Add RetryAfterSignal helper function" 2017-06-29 13:15:31 +00:00
Windows [CMake] Introduce LLVM_TARGET_TRIPLE_ENV as an option to override LLVM_DEFAULT_TARGET_TRIPLE at runtime. 2017-06-17 03:19:08 +00:00
Allocator.cpp
AMDGPUCodeObjectMetadata.cpp Fix ODR violations due to abuse of LLVM_YAML_IS_(FLOW_)?SEQUENCE_VECTOR 2017-06-30 20:56:57 +00:00
APFloat.cpp [APFloat] Move the integerPartWidth constant into APFloatBase. Remove integerPart typedef at file scope and just use the one in APFloatBase everywhere. NFC 2017-06-18 18:15:41 +00:00
APInt.cpp [APInt] Move the single word cases of countTrailingZeros and countLeadingOnes inline for consistency with countTrailingOnes and countLeadingZeros. NFCI 2017-06-23 20:28:45 +00:00
APSInt.cpp Remove some unneeded headers and replace some headers with forward class declarations (NFC) 2016-04-16 07:51:28 +00:00
ARMAttributeParser.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
ARMBuildAttrs.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
ARMWinEH.cpp
Atomic.cpp Fix another ordering constraint with windows.h and comment about 2017-06-06 12:43:20 +00:00
BinaryStreamError.cpp [Support] Move Stream library from MSF -> Support. 2017-03-02 20:52:51 +00:00
BinaryStreamReader.cpp Add a BinarySubstreamRef, and a method to read one. 2017-06-23 16:38:40 +00:00
BinaryStreamRef.cpp [BinaryStream] Reduce the amount of boiler plate needed to use. 2017-05-17 20:23:31 +00:00
BinaryStreamWriter.cpp Fix buildbots. 2017-06-16 02:42:33 +00:00
BlockFrequency.cpp Add - and -= operators to BlockFrequency using saturating arithmetic. 2015-10-12 18:34:00 +00:00
BranchProbability.cpp Cleanup dump() functions. 2017-01-28 02:02:38 +00:00
CachePruning.cpp Fix a misleading indentation warning. 2017-06-23 17:17:47 +00:00
Chrono.cpp Make naming in Host.h in line with coding standards. 2017-03-31 13:06:40 +00:00
circular_raw_ostream.cpp
CMakeLists.txt Move Object format code to lib/BinaryFormat. 2017-06-07 03:48:56 +00:00
COM.cpp
CommandLine.cpp [ADT] Add llvm::to_float 2017-06-23 12:55:02 +00:00
Compression.cpp Recommit r292214 "[Support/Compression] - Change zlib API to return Error instead of custom status" 2017-01-17 15:45:07 +00:00
ConvertUTF.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
ConvertUTFWrapper.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
COPYRIGHT.regex
CrashRecoveryContext.cpp Re-land r303274: "[CrashRecovery] Use SEH __try instead of VEH when available" 2017-05-17 18:16:17 +00:00
DAGDeltaAlgorithm.cpp
DataExtractor.cpp [DWARF] Support for DW_FORM_strx3 and complete support for DW_FORM_strx{1,2,4} 2017-06-21 19:37:44 +00:00
Debug.cpp Attempt to fix build bot after r290597 2016-12-27 10:24:58 +00:00
DebugCounter.cpp Hide dbgs() stream for when built with -fmodules. 2017-06-14 19:16:22 +00:00
DeltaAlgorithm.cpp Missing includes. 2016-09-14 08:55:18 +00:00
DynamicLibrary.cpp Fix the ManagedStatic list ordering when using DynamicLibrary::addPermanentLibrary. 2017-05-26 19:43:23 +00:00
Errno.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
Error.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
ErrorHandling.cpp [Support] Make all Errors convertible to std::error_code. 2016-03-23 23:57:28 +00:00
FileOutputBuffer.cpp Make FileOutputBuffer fail early if you pass a directory. 2017-03-13 22:19:05 +00:00
FileUtilities.cpp Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes. 2016-08-23 17:14:32 +00:00
FoldingSet.cpp [ADT] Reduce duplication between {Contextual,}FoldingSet; NFC 2017-06-12 20:52:53 +00:00
FormattedStream.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
FormatVariadic.cpp [Support] Introduce llvm::formatv() function. 2016-11-11 23:57:40 +00:00
GlobPattern.cpp Move GlobPattern class from LLD to llvm/Support. 2016-12-20 23:09:09 +00:00
GraphWriter.cpp [ProfileData, Support] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC). 2017-06-21 23:19:47 +00:00
Hashing.cpp
Host.cpp [LLVM][X86][Goldmont] Adding new target-cpu: Goldmont 2017-06-29 10:00:33 +00:00
IntEqClasses.cpp Remove uses of builtin comma operator. 2016-02-18 22:09:30 +00:00
IntervalMap.cpp
JamCRC.cpp [NFC] Header cleanup 2016-04-18 09:17:29 +00:00
LEB128.cpp
LineIterator.cpp
LLVMBuild.txt Add an c++ itanium demangler to llvm. 2016-09-06 19:16:48 +00:00
Locale.cpp [NFC] Header cleanup 2016-04-18 09:17:29 +00:00
LockFileManager.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
LowLevelType.cpp [GlobalISel] Support vector-of-pointers in LLT 2017-04-19 07:23:57 +00:00
ManagedStatic.cpp Revamp llvm::once_flag to be closer to std::once_flag 2017-02-05 21:13:06 +00:00
MathExtras.cpp Revert "Fix Clang-tidy modernize-deprecated-headers warnings in remaining files; other minor fixes." 2016-04-05 20:45:04 +00:00
MD5.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
Memory.cpp
MemoryBuffer.cpp Recommit "[Support] Add RetryAfterSignal helper function" 2017-06-29 13:15:31 +00:00
Mutex.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
NativeFormatting.cpp Remove dead variable Len. 2017-01-04 19:47:10 +00:00
Options.cpp
Parallel.cpp Fix -DLLVM_ENABLE_THREADS=OFF build after r302748 2017-05-11 15:32:47 +00:00
Path.cpp Move Object format code to lib/BinaryFormat. 2017-06-07 03:48:56 +00:00
PluginLoader.cpp
PrettyStackTrace.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
Process.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
Program.cpp
RandomNumberGenerator.cpp [Support] Fix undefined behavior in RandomNumberGenerator. 2016-10-11 18:17:26 +00:00
raw_os_ostream.cpp
raw_ostream.cpp Support: chunk writing on Linux 2017-06-20 20:51:51 +00:00
README.txt.system
regcclass.h
regcname.h
regcomp.c
regengine.inc
regerror.c
regex2.h
regex_impl.h
Regex.cpp Add const to a const method. NFC 2017-04-18 01:04:05 +00:00
regexec.c
regfree.c
regstrlcpy.c
regutils.h
RWMutex.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
ScaledNumber.cpp Replace APFloatBase static fltSemantics data members with getter functions 2016-12-14 11:57:17 +00:00
ScopedPrinter.cpp [llvm-pdbdump] Allow printing only a portion of a stream. 2017-04-28 00:43:38 +00:00
SHA1.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
Signals.cpp bugpoint: disabling symbolication of bugpoint-executed programs 2017-06-09 07:29:03 +00:00
SmallPtrSet.cpp [SmallPtrSet] Introduce a find primitive and rewrite count/erase in terms of it 2016-12-31 02:33:22 +00:00
SmallVector.cpp
SourceMgr.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
SpecialCaseList.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
Statistic.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
StringExtras.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
StringMap.cpp Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes. 2016-08-23 17:14:32 +00:00
StringPool.cpp
StringRef.cpp [Support] Add StringRef::getAsDouble. 2017-02-14 19:06:37 +00:00
StringSaver.cpp Use StringRef in StringSaver API (NFC) 2016-10-05 01:32:41 +00:00
SystemUtils.cpp
TargetParser.cpp Unified logic for computing target ABI in backend and front end by moving this common code to Support/TargetParser. 2017-06-30 00:03:54 +00:00
TargetRegistry.cpp Allow VersionPrinter to print to arbitrary raw_ostreams 2017-06-06 21:54:04 +00:00
TarWriter.cpp TarWriter: Fix a bug in Ustar header. 2017-01-09 22:55:00 +00:00
Threading.cpp Try to fix thread name truncation on non-Windows. 2017-03-04 18:53:09 +00:00
ThreadLocal.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
ThreadPool.cpp Support: Remove MSVC 2013 workarounds in ThreadPool class. 2017-06-14 00:36:21 +00:00
Timer.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
ToolOutputFile.cpp
TrigramIndex.cpp Sort the remaining #include lines in include/... and lib/.... 2017-06-06 11:49:48 +00:00
Triple.cpp Add support for Ananas platform 2017-06-25 08:19:37 +00:00
Twine.cpp Cleanup dump() functions. 2017-01-28 02:02:38 +00:00
Unicode.cpp
Valgrind.cpp Add a missing include of cstddef needed for size_t. 2015-10-15 19:41:54 +00:00
Watchdog.cpp
xxhash.cpp Revert r301487: Replace HashString algorithm with xxHash64 2017-04-26 23:15:10 +00:00
YAMLParser.cpp [ProfileData, Support] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC). 2017-06-21 23:19:47 +00:00
YAMLTraits.cpp [ADT] Add llvm::to_float 2017-06-23 12:55:02 +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