diff options
Diffstat (limited to 'lib/Support')
-rw-r--r-- | lib/Support/APFloat.cpp | 2 | ||||
-rw-r--r-- | lib/Support/ConvertUTF.cpp | 28 | ||||
-rw-r--r-- | lib/Support/CrashRecoveryContext.cpp | 4 | ||||
-rw-r--r-- | lib/Support/DAGDeltaAlgorithm.cpp | 6 | ||||
-rw-r--r-- | lib/Support/Errno.cpp | 2 | ||||
-rw-r--r-- | lib/Support/FoldingSet.cpp | 40 | ||||
-rw-r--r-- | lib/Support/FormattedStream.cpp | 2 | ||||
-rw-r--r-- | lib/Support/ManagedStatic.cpp | 6 | ||||
-rw-r--r-- | lib/Support/MemoryBuffer.cpp | 5 | ||||
-rw-r--r-- | lib/Support/Path.cpp | 10 | ||||
-rw-r--r-- | lib/Support/PrettyStackTrace.cpp | 20 | ||||
-rw-r--r-- | lib/Support/SourceMgr.cpp | 24 | ||||
-rw-r--r-- | lib/Support/StringPool.cpp | 4 | ||||
-rw-r--r-- | lib/Support/StringRef.cpp | 2 | ||||
-rw-r--r-- | lib/Support/TargetRegistry.cpp | 2 | ||||
-rw-r--r-- | lib/Support/Windows/Path.inc | 2 | ||||
-rw-r--r-- | lib/Support/YAMLParser.cpp | 2 | ||||
-rw-r--r-- | lib/Support/regex_impl.h | 2 | ||||
-rw-r--r-- | lib/Support/xxhash.cpp | 4 |
19 files changed, 87 insertions, 80 deletions
diff --git a/lib/Support/APFloat.cpp b/lib/Support/APFloat.cpp index 24005c1890c9..e9e429c8031b 100644 --- a/lib/Support/APFloat.cpp +++ b/lib/Support/APFloat.cpp @@ -1752,7 +1752,7 @@ IEEEFloat::opStatus IEEEFloat::mod(const IEEEFloat &rhs) { if (compareAbsoluteValue(V) == cmpLessThan) V = scalbn(V, -1, rmNearestTiesToEven); V.sign = sign; - + fs = subtract(V, rmNearestTiesToEven); assert(fs==opOK); } diff --git a/lib/Support/ConvertUTF.cpp b/lib/Support/ConvertUTF.cpp index e56854a3ae42..8f02fae4f558 100644 --- a/lib/Support/ConvertUTF.cpp +++ b/lib/Support/ConvertUTF.cpp @@ -8,9 +8,9 @@ *===------------------------------------------------------------------------=*/ /* * Copyright 2001-2004 Unicode, Inc. - * + * * Disclaimer - * + * * This source code is provided as is by Unicode, Inc. No claims are * made as to fitness for any particular purpose. No warranties of any * kind are expressed or implied. The recipient agrees to determine @@ -18,9 +18,9 @@ * purchased on magnetic or optical media from Unicode, Inc., the * sole remedy for any claim will be exchange of defective media * within 90 days of receipt. - * + * * Limitations on Rights to Redistribute This Code - * + * * Unicode, Inc. hereby grants the right to freely use the information * supplied in this file in the creation of products supporting the * Unicode Standard, and to make copies of this file in any form @@ -117,7 +117,7 @@ static const char trailingBytesForUTF8[256] = { * This table contains as many values as there might be trailing bytes * in a UTF-8 sequence. */ -static const UTF32 offsetsFromUTF8[6] = { 0x00000000UL, 0x00003080UL, 0x000E2080UL, +static const UTF32 offsetsFromUTF8[6] = { 0x00000000UL, 0x00003080UL, 0x000E2080UL, 0x03C82080UL, 0xFA082080UL, 0x82082080UL }; /* @@ -143,7 +143,7 @@ static const UTF8 firstByteMark[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC /* --------------------------------------------------------------------- */ ConversionResult ConvertUTF32toUTF16 ( - const UTF32** sourceStart, const UTF32* sourceEnd, + const UTF32** sourceStart, const UTF32* sourceEnd, UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags) { ConversionResult result = conversionOK; const UTF32* source = *sourceStart; @@ -192,7 +192,7 @@ ConversionResult ConvertUTF32toUTF16 ( /* --------------------------------------------------------------------- */ ConversionResult ConvertUTF16toUTF32 ( - const UTF16** sourceStart, const UTF16* sourceEnd, + const UTF16** sourceStart, const UTF16* sourceEnd, UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags) { ConversionResult result = conversionOK; const UTF16* source = *sourceStart; @@ -246,7 +246,7 @@ if (result == sourceIllegal) { return result; } ConversionResult ConvertUTF16toUTF8 ( - const UTF16** sourceStart, const UTF16* sourceEnd, + const UTF16** sourceStart, const UTF16* sourceEnd, UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags) { ConversionResult result = conversionOK; const UTF16* source = *sourceStart; @@ -255,7 +255,7 @@ ConversionResult ConvertUTF16toUTF8 ( UTF32 ch; unsigned short bytesToWrite = 0; const UTF32 byteMask = 0xBF; - const UTF32 byteMark = 0x80; + const UTF32 byteMark = 0x80; const UTF16* oldSource = source; /* In case we have to back up because of target overflow. */ ch = *source++; /* If we have a surrogate pair, convert to UTF32 first. */ @@ -316,7 +316,7 @@ ConversionResult ConvertUTF16toUTF8 ( /* --------------------------------------------------------------------- */ ConversionResult ConvertUTF32toUTF8 ( - const UTF32** sourceStart, const UTF32* sourceEnd, + const UTF32** sourceStart, const UTF32* sourceEnd, UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags) { ConversionResult result = conversionOK; const UTF32* source = *sourceStart; @@ -325,7 +325,7 @@ ConversionResult ConvertUTF32toUTF8 ( UTF32 ch; unsigned short bytesToWrite = 0; const UTF32 byteMask = 0xBF; - const UTF32 byteMark = 0x80; + const UTF32 byteMark = 0x80; ch = *source++; if (flags == strictConversion ) { /* UTF-16 surrogate values are illegal in UTF-32 */ @@ -347,7 +347,7 @@ ConversionResult ConvertUTF32toUTF8 ( ch = UNI_REPLACEMENT_CHAR; result = sourceIllegal; } - + target += bytesToWrite; if (target > targetEnd) { --source; /* Back up source pointer! */ @@ -540,7 +540,7 @@ Boolean isLegalUTF8String(const UTF8 **source, const UTF8 *sourceEnd) { /* --------------------------------------------------------------------- */ ConversionResult ConvertUTF8toUTF16 ( - const UTF8** sourceStart, const UTF8* sourceEnd, + const UTF8** sourceStart, const UTF8* sourceEnd, UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags) { ConversionResult result = conversionOK; const UTF8* source = *sourceStart; @@ -613,7 +613,7 @@ ConversionResult ConvertUTF8toUTF16 ( /* --------------------------------------------------------------------- */ static ConversionResult ConvertUTF8toUTF32Impl( - const UTF8** sourceStart, const UTF8* sourceEnd, + const UTF8** sourceStart, const UTF8* sourceEnd, UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags, Boolean InputIsPartial) { ConversionResult result = conversionOK; diff --git a/lib/Support/CrashRecoveryContext.cpp b/lib/Support/CrashRecoveryContext.cpp index fd5d097d2b7e..be4b5c3e01c3 100644 --- a/lib/Support/CrashRecoveryContext.cpp +++ b/lib/Support/CrashRecoveryContext.cpp @@ -49,7 +49,7 @@ public: /// Called when the separate crash-recovery thread was finished, to /// indicate that we don't need to clear the thread-local CurrentContext. - void setSwitchedThread() { + void setSwitchedThread() { #if defined(LLVM_ENABLE_THREADS) && LLVM_ENABLE_THREADS != 0 SwitchedThread = true; #endif @@ -96,7 +96,7 @@ CrashRecoveryContext::~CrashRecoveryContext() { delete tmp; } tlIsRecoveringFromCrash->set(PC); - + CrashRecoveryContextImpl *CRCI = (CrashRecoveryContextImpl *) Impl; delete CRCI; } diff --git a/lib/Support/DAGDeltaAlgorithm.cpp b/lib/Support/DAGDeltaAlgorithm.cpp index b82aec1423f5..bd9f98b0b82d 100644 --- a/lib/Support/DAGDeltaAlgorithm.cpp +++ b/lib/Support/DAGDeltaAlgorithm.cpp @@ -96,7 +96,7 @@ private: assert(PredClosure.count(Node) && "Invalid node!"); return PredClosure[Node].end(); } - + succ_iterator_ty succ_begin(change_ty Node) { assert(Successors.count(Node) && "Invalid node!"); return Successors[Node].begin(); @@ -205,7 +205,7 @@ DAGDeltaAlgorithmImpl::DAGDeltaAlgorithmImpl( Worklist.pop_back(); std::set<change_ty> &ChangeSuccs = SuccClosure[Change]; - for (pred_iterator_ty it = pred_begin(Change), + for (pred_iterator_ty it = pred_begin(Change), ie = pred_end(Change); it != ie; ++it) { SuccClosure[*it].insert(Change); SuccClosure[*it].insert(ChangeSuccs.begin(), ChangeSuccs.end()); @@ -222,7 +222,7 @@ DAGDeltaAlgorithmImpl::DAGDeltaAlgorithmImpl( for (succ_closure_iterator_ty it2 = succ_closure_begin(*it), ie2 = succ_closure_end(*it); it2 != ie2; ++it2) PredClosure[*it2].insert(*it); - + // Dump useful debug info. LLVM_DEBUG({ llvm::errs() << "-- DAGDeltaAlgorithmImpl --\n"; diff --git a/lib/Support/Errno.cpp b/lib/Support/Errno.cpp index 10be9b391b49..2149f21281d3 100644 --- a/lib/Support/Errno.cpp +++ b/lib/Support/Errno.cpp @@ -42,7 +42,7 @@ std::string StrError(int errnum) { const int MaxErrStrLen = 2000; char buffer[MaxErrStrLen]; buffer[0] = '\0'; -#endif +#endif #ifdef HAVE_STRERROR_R // strerror_r is thread-safe. diff --git a/lib/Support/FoldingSet.cpp b/lib/Support/FoldingSet.cpp index ec7d57586e8b..cf9847faccd1 100644 --- a/lib/Support/FoldingSet.cpp +++ b/lib/Support/FoldingSet.cpp @@ -92,7 +92,7 @@ void FoldingSetNodeID::AddString(StringRef String) { unsigned Units = Size / 4; unsigned Pos = 0; const unsigned *Base = (const unsigned*) String.data(); - + // If the string is aligned do a bulk transfer. if (!((intptr_t)Base & 3)) { Bits.append(Base, Base + Units); @@ -121,7 +121,7 @@ void FoldingSetNodeID::AddString(StringRef String) { } } } - + // With the leftover bits. unsigned V = 0; // Pos will have overshot size by 4 - #bytes left over. @@ -141,7 +141,7 @@ void FoldingSetNodeID::AddNodeID(const FoldingSetNodeID &ID) { Bits.append(ID.Bits.begin(), ID.Bits.end()); } -/// ComputeHash - Compute a strong hash value for this FoldingSetNodeID, used to +/// ComputeHash - Compute a strong hash value for this FoldingSetNodeID, used to /// lookup the node in the FoldingSetBase. unsigned FoldingSetNodeID::ComputeHash() const { return FoldingSetNodeIDRef(Bits.data(), Bits.size()).ComputeHash(); @@ -192,7 +192,7 @@ static FoldingSetBase::Node *GetNextPtr(void *NextInBucketPtr) { // The low bit is set if this is the pointer back to the bucket. if (reinterpret_cast<intptr_t>(NextInBucketPtr) & 1) return nullptr; - + return static_cast<FoldingSetBase::Node*>(NextInBucketPtr); } @@ -272,11 +272,11 @@ void FoldingSetBase::GrowBucketCount(unsigned NewBucketCount) { assert(isPowerOf2_32(NewBucketCount) && "Bad bucket count!"); void **OldBuckets = Buckets; unsigned OldNumBuckets = NumBuckets; - + // Clear out new buckets. Buckets = AllocateBuckets(NewBucketCount); // Set NumBuckets only if allocation of new buckets was succesful - NumBuckets = NewBucketCount; + NumBuckets = NewBucketCount; NumNodes = 0; // Walk the old buckets, rehashing nodes into their new place. @@ -296,7 +296,7 @@ void FoldingSetBase::GrowBucketCount(unsigned NewBucketCount) { TempID.clear(); } } - + free(OldBuckets); } @@ -324,9 +324,9 @@ FoldingSetBase::FindNodeOrInsertPos(const FoldingSetNodeID &ID, unsigned IDHash = ID.ComputeHash(); void **Bucket = GetBucketFor(IDHash, Buckets, NumBuckets); void *Probe = *Bucket; - + InsertPos = nullptr; - + FoldingSetNodeID TempID; while (Node *NodeInBucket = GetNextPtr(Probe)) { if (NodeEquals(NodeInBucket, ID, IDHash, TempID)) @@ -335,14 +335,14 @@ FoldingSetBase::FindNodeOrInsertPos(const FoldingSetNodeID &ID, Probe = NodeInBucket->getNextInBucket(); } - + // Didn't find the node, return null with the bucket as the InsertPos. InsertPos = Bucket; return nullptr; } /// InsertNode - Insert the specified node into the folding set, knowing that it -/// is not already in the map. InsertPos must be obtained from +/// is not already in the map. InsertPos must be obtained from /// FindNodeOrInsertPos. void FoldingSetBase::InsertNode(Node *N, void *InsertPos) { assert(!N->getNextInBucket()); @@ -354,12 +354,12 @@ void FoldingSetBase::InsertNode(Node *N, void *InsertPos) { } ++NumNodes; - + /// The insert position is actually a bucket pointer. void **Bucket = static_cast<void**>(InsertPos); - + void *Next = *Bucket; - + // If this is the first insertion into this bucket, its next pointer will be // null. Pretend as if it pointed to itself, setting the low bit to indicate // that it is a pointer to the bucket. @@ -384,13 +384,13 @@ bool FoldingSetBase::RemoveNode(Node *N) { // Remember what N originally pointed to, either a bucket or another node. void *NodeNextPtr = Ptr; - + // Chase around the list until we find the node (or bucket) which points to N. while (true) { if (Node *NodeInBucket = GetNextPtr(Ptr)) { // Advance pointer. Ptr = NodeInBucket->getNextInBucket(); - + // We found a node that points to N, change it to point to N's next node, // removing N from the list. if (Ptr == N) { @@ -400,7 +400,7 @@ bool FoldingSetBase::RemoveNode(Node *N) { } else { void **Bucket = GetBucketPtr(Ptr); Ptr = *Bucket; - + // If we found that the bucket points to N, update the bucket to point to // whatever is next. if (Ptr == N) { @@ -432,7 +432,7 @@ FoldingSetIteratorImpl::FoldingSetIteratorImpl(void **Bucket) { while (*Bucket != reinterpret_cast<void*>(-1) && (!*Bucket || !GetNextPtr(*Bucket))) ++Bucket; - + NodePtr = static_cast<FoldingSetNode*>(*Bucket); } @@ -443,7 +443,7 @@ void FoldingSetIteratorImpl::advance() { if (FoldingSetNode *NextNodeInBucket = GetNextPtr(Probe)) NodePtr = NextNodeInBucket; else { - // Otherwise, this is the last link in this bucket. + // Otherwise, this is the last link in this bucket. void **Bucket = GetBucketPtr(Probe); // Skip to the next non-null non-self-cycle bucket. @@ -451,7 +451,7 @@ void FoldingSetIteratorImpl::advance() { ++Bucket; } while (*Bucket != reinterpret_cast<void*>(-1) && (!*Bucket || !GetNextPtr(*Bucket))); - + NodePtr = static_cast<FoldingSetNode*>(*Bucket); } } diff --git a/lib/Support/FormattedStream.cpp b/lib/Support/FormattedStream.cpp index a9f4409f5dde..b0cb06c1daa2 100644 --- a/lib/Support/FormattedStream.cpp +++ b/lib/Support/FormattedStream.cpp @@ -65,7 +65,7 @@ void formatted_raw_ostream::ComputePosition(const char *Ptr, size_t Size) { /// /// \param NewCol - The column to move to. /// -formatted_raw_ostream &formatted_raw_ostream::PadToColumn(unsigned NewCol) { +formatted_raw_ostream &formatted_raw_ostream::PadToColumn(unsigned NewCol) { // Figure out what's in the buffer and add it to the column count. ComputePosition(getBufferStart(), GetNumBytesInBuffer()); diff --git a/lib/Support/ManagedStatic.cpp b/lib/Support/ManagedStatic.cpp index 1c884dc70fc9..74f71a385027 100644 --- a/lib/Support/ManagedStatic.cpp +++ b/lib/Support/ManagedStatic.cpp @@ -43,7 +43,7 @@ void ManagedStaticBase::RegisterManagedStatic(void *(*Creator)(), Ptr.store(Tmp, std::memory_order_release); DeleterFn = Deleter; - + // Add to list of managed statics. Next = StaticList; StaticList = this; @@ -53,7 +53,7 @@ void ManagedStaticBase::RegisterManagedStatic(void *(*Creator)(), "Partially initialized ManagedStatic!?"); Ptr = Creator(); DeleterFn = Deleter; - + // Add to list of managed statics. Next = StaticList; StaticList = this; @@ -70,7 +70,7 @@ void ManagedStaticBase::destroy() const { // Destroy memory. DeleterFn(Ptr); - + // Cleanup. Ptr = nullptr; DeleterFn = nullptr; diff --git a/lib/Support/MemoryBuffer.cpp b/lib/Support/MemoryBuffer.cpp index 4428c2f24e32..ef9159bac284 100644 --- a/lib/Support/MemoryBuffer.cpp +++ b/lib/Support/MemoryBuffer.cpp @@ -152,7 +152,7 @@ MemoryBuffer::getFileOrSTDIN(const Twine &Filename, int64_t FileSize, } ErrorOr<std::unique_ptr<MemoryBuffer>> -MemoryBuffer::getFileSlice(const Twine &FilePath, uint64_t MapSize, +MemoryBuffer::getFileSlice(const Twine &FilePath, uint64_t MapSize, uint64_t Offset, bool IsVolatile) { return getFileAux<MemoryBuffer>(FilePath, -1, MapSize, Offset, false, IsVolatile); @@ -533,5 +533,4 @@ MemoryBufferRef MemoryBuffer::getMemBufferRef() const { return MemoryBufferRef(Data, Identifier); } -void MemoryBuffer::anchor() {} -void SmallVectorMemoryBuffer::anchor() {} +SmallVectorMemoryBuffer::~SmallVectorMemoryBuffer() {} diff --git a/lib/Support/Path.cpp b/lib/Support/Path.cpp index a806da23ec50..098230290ed2 100644 --- a/lib/Support/Path.cpp +++ b/lib/Support/Path.cpp @@ -1157,9 +1157,13 @@ Error TempFile::keep(const Twine &Name) { setDeleteDisposition(H, true); #else std::error_code RenameEC = fs::rename(TmpName, Name); - // If we can't rename, discard the temporary file. - if (RenameEC) - remove(TmpName); + if (RenameEC) { + // If we can't rename, try to copy to work around cross-device link issues. + RenameEC = sys::fs::copy_file(TmpName, Name); + // If we can't rename or copy, discard the temporary file. + if (RenameEC) + remove(TmpName); + } sys::DontRemoveFileOnSignal(TmpName); #endif diff --git a/lib/Support/PrettyStackTrace.cpp b/lib/Support/PrettyStackTrace.cpp index f5b6e6f3652d..206de91ae239 100644 --- a/lib/Support/PrettyStackTrace.cpp +++ b/lib/Support/PrettyStackTrace.cpp @@ -1,10 +1,10 @@ //===- PrettyStackTrace.cpp - Pretty Crash Handling -----------------------===// -// +// // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This file defines some helpful functions for dealing with the possibility of @@ -72,10 +72,10 @@ static void PrintStack(raw_ostream &OS) { static void PrintCurStackTrace(raw_ostream &OS) { // Don't print an empty trace. if (!PrettyStackTraceHead) return; - + // If there are pretty stack frames registered, walk and emit them. OS << "Stack dump:\n"; - + PrintStack(OS); OS.flush(); } @@ -85,9 +85,9 @@ static void PrintCurStackTrace(raw_ostream &OS) { // If any clients of llvm try to link to libCrashReporterClient.a themselves, // only one crash info struct will be used. extern "C" { -CRASH_REPORTER_CLIENT_HIDDEN -struct crashreporter_annotations_t gCRAnnotations - __attribute__((section("__DATA," CRASHREPORTER_ANNOTATIONS_SECTION))) +CRASH_REPORTER_CLIENT_HIDDEN +struct crashreporter_annotations_t gCRAnnotations + __attribute__((section("__DATA," CRASHREPORTER_ANNOTATIONS_SECTION))) #if CRASHREPORTER_ANNOTATIONS_VERSION < 5 = { CRASHREPORTER_ANNOTATIONS_VERSION, 0, 0, 0, 0, 0, 0 }; #else @@ -114,17 +114,17 @@ static void CrashHandler(void *) { raw_svector_ostream Stream(TmpStr); PrintCurStackTrace(Stream); } - + if (!TmpStr.empty()) { #ifdef HAVE_CRASHREPORTERCLIENT_H // Cast to void to avoid warning. (void)CRSetCrashLogMessage(TmpStr.c_str()); -#elif HAVE_CRASHREPORTER_INFO +#elif HAVE_CRASHREPORTER_INFO __crashreporter_info__ = strdup(TmpStr.c_str()); #endif errs() << TmpStr.str(); } - + #endif } diff --git a/lib/Support/SourceMgr.cpp b/lib/Support/SourceMgr.cpp index bc15fd4e4014..d8fde7fa8990 100644 --- a/lib/Support/SourceMgr.cpp +++ b/lib/Support/SourceMgr.cpp @@ -175,14 +175,14 @@ SMDiagnostic SourceMgr::GetMessage(SMLoc Loc, SourceMgr::DiagKind Kind, std::pair<unsigned, unsigned> LineAndCol; StringRef BufferID = "<unknown>"; std::string LineStr; - + if (Loc.isValid()) { unsigned CurBuf = FindBufferContainingLoc(Loc); assert(CurBuf && "Invalid or unspecified location!"); const MemoryBuffer *CurMB = getMemoryBuffer(CurBuf); BufferID = CurMB->getBufferIdentifier(); - + // Scan backward to find the start of the line. const char *LineStart = Loc.getPointer(); const char *BufStart = CurMB->getBufferStart(); @@ -202,17 +202,17 @@ SMDiagnostic SourceMgr::GetMessage(SMLoc Loc, SourceMgr::DiagKind Kind, for (unsigned i = 0, e = Ranges.size(); i != e; ++i) { SMRange R = Ranges[i]; if (!R.isValid()) continue; - + // If the line doesn't contain any part of the range, then ignore it. if (R.Start.getPointer() > LineEnd || R.End.getPointer() < LineStart) continue; - + // Ignore pieces of the range that go onto other lines. if (R.Start.getPointer() < LineStart) R.Start = SMLoc::getFromPointer(LineStart); if (R.End.getPointer() > LineEnd) R.End = SMLoc::getFromPointer(LineEnd); - + // Translate from SMLoc ranges to column ranges. // FIXME: Handle multibyte characters. ColRanges.push_back(std::make_pair(R.Start.getPointer()-LineStart, @@ -221,7 +221,7 @@ SMDiagnostic SourceMgr::GetMessage(SMLoc Loc, SourceMgr::DiagKind Kind, LineAndCol = getLineAndColumn(Loc, CurBuf); } - + return SMDiagnostic(*this, Loc, BufferID, LineAndCol.first, LineAndCol.second-1, Kind, Msg.str(), LineStr, ColRanges, FixIts); @@ -440,7 +440,7 @@ void SMDiagnostic::print(const char *ProgName, raw_ostream &S, bool ShowColors, // Build the line with the caret and ranges. std::string CaretLine(NumColumns+1, ' '); - + // Expand any ranges. for (unsigned r = 0, e = Ranges.size(); r != e; ++r) { std::pair<unsigned, unsigned> R = Ranges[r]; @@ -459,14 +459,14 @@ void SMDiagnostic::print(const char *ProgName, raw_ostream &S, bool ShowColors, // Finally, plop on the caret. if (unsigned(ColumnNo) <= NumColumns) CaretLine[ColumnNo] = '^'; - else + else CaretLine[NumColumns] = '^'; - + // ... and remove trailing whitespace so the output doesn't wrap for it. We // know that the line isn't completely empty because it has the caret in it at // least. CaretLine.erase(CaretLine.find_last_not_of(' ')+1); - + printSourceLine(S, LineContents); if (ShowColors) @@ -479,7 +479,7 @@ void SMDiagnostic::print(const char *ProgName, raw_ostream &S, bool ShowColors, ++OutCol; continue; } - + // Okay, we have a tab. Insert the appropriate number of characters. do { S << CaretLine[i]; @@ -494,7 +494,7 @@ void SMDiagnostic::print(const char *ProgName, raw_ostream &S, bool ShowColors, // Print out the replacement line, matching tabs in the source line. if (FixItInsertionLine.empty()) return; - + for (size_t i = 0, e = FixItInsertionLine.size(), OutCol = 0; i < e; ++i) { if (i >= LineContents.size() || LineContents[i] != '\t') { S << FixItInsertionLine[i]; diff --git a/lib/Support/StringPool.cpp b/lib/Support/StringPool.cpp index 76faabc92bb5..c591857c415d 100644 --- a/lib/Support/StringPool.cpp +++ b/lib/Support/StringPool.cpp @@ -26,10 +26,10 @@ PooledStringPtr StringPool::intern(StringRef Key) { table_t::iterator I = InternTable.find(Key); if (I != InternTable.end()) return PooledStringPtr(&*I); - + entry_t *S = entry_t::Create(Key); S->getValue().Pool = this; InternTable.insert(S); - + return PooledStringPtr(S); } diff --git a/lib/Support/StringRef.cpp b/lib/Support/StringRef.cpp index 9ba7a09f9962..f0349260e22f 100644 --- a/lib/Support/StringRef.cpp +++ b/lib/Support/StringRef.cpp @@ -389,7 +389,7 @@ static unsigned GetAutoSenseRadix(StringRef &Str) { Str = Str.substr(2); return 16; } - + if (Str.startswith("0b") || Str.startswith("0B")) { Str = Str.substr(2); return 2; diff --git a/lib/Support/TargetRegistry.cpp b/lib/Support/TargetRegistry.cpp index ed999fce5dad..c5eba5714766 100644 --- a/lib/Support/TargetRegistry.cpp +++ b/lib/Support/TargetRegistry.cpp @@ -98,7 +98,7 @@ void TargetRegistry::RegisterTarget(Target &T, const char *Name, // convenience to some clients. if (T.Name) return; - + // Add to the list of targets. T.Next = FirstTarget; FirstTarget = &T; diff --git a/lib/Support/Windows/Path.inc b/lib/Support/Windows/Path.inc index f425d607af47..b64b013d7407 100644 --- a/lib/Support/Windows/Path.inc +++ b/lib/Support/Windows/Path.inc @@ -450,7 +450,7 @@ static std::error_code rename_handle(HANDLE FromHandle, const Twine &To) { if (std::error_code EC2 = realPathFromHandle(FromHandle, WideFrom)) return EC2; if (::MoveFileExW(WideFrom.begin(), WideTo.begin(), - MOVEFILE_REPLACE_EXISTING)) + MOVEFILE_REPLACE_EXISTING | MOVEFILE_COPY_ALLOWED)) return std::error_code(); return mapWindowsError(GetLastError()); } diff --git a/lib/Support/YAMLParser.cpp b/lib/Support/YAMLParser.cpp index 354b7d0740de..9ef1410b99a5 100644 --- a/lib/Support/YAMLParser.cpp +++ b/lib/Support/YAMLParser.cpp @@ -1113,7 +1113,7 @@ bool Scanner::scanDirective() { Current = skip_while(&Scanner::skip_ns_char, Current); StringRef Name(NameStart, Current - NameStart); Current = skip_while(&Scanner::skip_s_white, Current); - + Token T; if (Name == "YAML") { Current = skip_while(&Scanner::skip_ns_char, Current); diff --git a/lib/Support/regex_impl.h b/lib/Support/regex_impl.h index f8296c9ff75e..8ddac7dcf998 100644 --- a/lib/Support/regex_impl.h +++ b/lib/Support/regex_impl.h @@ -96,7 +96,7 @@ extern "C" { int llvm_regcomp(llvm_regex_t *, const char *, int); size_t llvm_regerror(int, const llvm_regex_t *, char *, size_t); -int llvm_regexec(const llvm_regex_t *, const char *, size_t, +int llvm_regexec(const llvm_regex_t *, const char *, size_t, llvm_regmatch_t [], int); void llvm_regfree(llvm_regex_t *); size_t llvm_strlcpy(char *dst, const char *src, size_t siz); diff --git a/lib/Support/xxhash.cpp b/lib/Support/xxhash.cpp index df643f9bd639..e9dceed2c4ae 100644 --- a/lib/Support/xxhash.cpp +++ b/lib/Support/xxhash.cpp @@ -132,3 +132,7 @@ uint64_t llvm::xxHash64(StringRef Data) { return H64; } + +uint64_t llvm::xxHash64(ArrayRef<uint8_t> Data) { + return xxHash64({(const char *)Data.data(), Data.size()}); +} |