forked from OSchip/llvm-project
std::isspace -> llvm::isSpace (where locale should be ignored)
I've left out some cases where I wasn't totally sure this was right or whether the include was ok (compiler-rt) or idiomatic (flang).
This commit is contained in:
parent
b283ae7af8
commit
d10c995b4d
|
@ -76,7 +76,7 @@ static std::string getExprAsString(const clang::Expr &E,
|
|||
Text.erase(
|
||||
llvm::remove_if(
|
||||
Text,
|
||||
[](char C) { return std::isspace(static_cast<unsigned char>(C)); }),
|
||||
[](char C) { return llvm::isSpace(static_cast<unsigned char>(C)); }),
|
||||
Text.end());
|
||||
return Text;
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "clang/AST/RecursiveASTVisitor.h"
|
||||
#include "clang/ASTMatchers/ASTMatchFinder.h"
|
||||
#include "clang/Tooling/FixIt.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
|
||||
#include <cctype>
|
||||
|
||||
|
@ -356,10 +357,10 @@ bool UseTrailingReturnTypeCheck::keepSpecifiers(
|
|||
unsigned int TOffsetInRT = TOffset - ReturnTypeBeginOffset - DeletedChars;
|
||||
unsigned int TLengthWithWS = CT.T.getLength();
|
||||
while (TOffsetInRT + TLengthWithWS < ReturnType.size() &&
|
||||
std::isspace(ReturnType[TOffsetInRT + TLengthWithWS]))
|
||||
llvm::isSpace(ReturnType[TOffsetInRT + TLengthWithWS]))
|
||||
TLengthWithWS++;
|
||||
std::string Specifier = ReturnType.substr(TOffsetInRT, TLengthWithWS);
|
||||
if (!std::isspace(Specifier.back()))
|
||||
if (!llvm::isSpace(Specifier.back()))
|
||||
Specifier.push_back(' ');
|
||||
Auto.insert(Auto.size() - InitialAutoLength, Specifier);
|
||||
ReturnType.erase(TOffsetInRT, TLengthWithWS);
|
||||
|
@ -459,7 +460,7 @@ void UseTrailingReturnTypeCheck::check(const MatchFinder::MatchResult &Result) {
|
|||
ReturnTypeEnd.getLocWithOffset(1)),
|
||||
SM, LangOpts);
|
||||
bool NeedSpaceAfterAuto =
|
||||
CharAfterReturnType.empty() || !std::isspace(CharAfterReturnType[0]);
|
||||
CharAfterReturnType.empty() || !llvm::isSpace(CharAfterReturnType[0]);
|
||||
|
||||
std::string Auto = NeedSpaceAfterAuto ? "auto " : "auto";
|
||||
std::string ReturnType =
|
||||
|
|
|
@ -75,7 +75,7 @@ mutatedBy(const SmallVectorImpl<BoundNodes> &Results, ASTUnit *AST) {
|
|||
|
||||
std::string removeSpace(std::string s) {
|
||||
s.erase(std::remove_if(s.begin(), s.end(),
|
||||
[](char c) { return std::isspace(c); }),
|
||||
[](char c) { return llvm::isSpace(c); }),
|
||||
s.end());
|
||||
return s;
|
||||
}
|
||||
|
|
|
@ -649,8 +649,8 @@ inline bool isBool(StringRef S) {
|
|||
inline QuotingType needsQuotes(StringRef S) {
|
||||
if (S.empty())
|
||||
return QuotingType::Single;
|
||||
if (isspace(static_cast<unsigned char>(S.front())) ||
|
||||
isspace(static_cast<unsigned char>(S.back())))
|
||||
if (isSpace(static_cast<unsigned char>(S.front())) ||
|
||||
isSpace(static_cast<unsigned char>(S.back())))
|
||||
return QuotingType::Single;
|
||||
if (isNull(S))
|
||||
return QuotingType::Single;
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/CodeGen/TargetInstrInfo.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/CodeGen/MachineFrameInfo.h"
|
||||
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
||||
#include "llvm/CodeGen/MachineMemOperand.h"
|
||||
|
@ -104,14 +105,14 @@ unsigned TargetInstrInfo::getInlineAsmLength(
|
|||
AtInsnStart = false;
|
||||
}
|
||||
|
||||
if (AtInsnStart && !std::isspace(static_cast<unsigned char>(*Str))) {
|
||||
if (AtInsnStart && !isSpace(static_cast<unsigned char>(*Str))) {
|
||||
unsigned AddLength = MaxInstLength;
|
||||
if (strncmp(Str, ".space", 6) == 0) {
|
||||
char *EStr;
|
||||
int SpaceSize;
|
||||
SpaceSize = strtol(Str + 6, &EStr, 10);
|
||||
SpaceSize = SpaceSize < 0 ? 0 : SpaceSize;
|
||||
while (*EStr != '\n' && std::isspace(static_cast<unsigned char>(*EStr)))
|
||||
while (*EStr != '\n' && isSpace(static_cast<unsigned char>(*EStr)))
|
||||
++EStr;
|
||||
if (*EStr == '\0' || *EStr == '\n' ||
|
||||
isAsmComment(EStr, MAI)) // Successfully parsed .space argument
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "llvm/ExecutionEngine/RuntimeDyldChecker.h"
|
||||
#include "RuntimeDyldCheckerImpl.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/MC/MCContext.h"
|
||||
#include "llvm/MC/MCDisassembler/MCDisassembler.h"
|
||||
#include "llvm/MC/MCInst.h"
|
||||
|
@ -708,7 +709,7 @@ bool RuntimeDyldCheckerImpl::checkAllRulesInBuffer(StringRef RulePrefix,
|
|||
const char *LineStart = MemBuf->getBufferStart();
|
||||
|
||||
// Eat whitespace.
|
||||
while (LineStart != MemBuf->getBufferEnd() && std::isspace(*LineStart))
|
||||
while (LineStart != MemBuf->getBufferEnd() && isSpace(*LineStart))
|
||||
++LineStart;
|
||||
|
||||
while (LineStart != MemBuf->getBufferEnd() && *LineStart != '\0') {
|
||||
|
@ -734,7 +735,7 @@ bool RuntimeDyldCheckerImpl::checkAllRulesInBuffer(StringRef RulePrefix,
|
|||
|
||||
// Eat whitespace.
|
||||
LineStart = LineEnd;
|
||||
while (LineStart != MemBuf->getBufferEnd() && std::isspace(*LineStart))
|
||||
while (LineStart != MemBuf->getBufferEnd() && isSpace(*LineStart))
|
||||
++LineStart;
|
||||
}
|
||||
return DidAllTestsPass && (NumRules != 0);
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/IR/ProfileSummary.h"
|
||||
#include "llvm/ProfileData/InstrProf.h"
|
||||
|
@ -144,7 +145,7 @@ bool TextInstrProfReader::hasFormat(const MemoryBuffer &Buffer) {
|
|||
StringRef buffer = Buffer.getBufferStart();
|
||||
return count == 0 ||
|
||||
std::all_of(buffer.begin(), buffer.begin() + count,
|
||||
[](char c) { return isPrint(c) || ::isspace(c); });
|
||||
[](char c) { return isPrint(c) || isSpace(c); });
|
||||
}
|
||||
|
||||
// Read the profile variant flag from the header: ":FE" means this is a FE
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "llvm/Support/FileUtilities.h"
|
||||
#include "llvm/ADT/ScopeExit.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include "llvm/Support/ErrorOr.h"
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
|
@ -92,9 +93,9 @@ static bool CompareNumbers(const char *&F1P, const char *&F2P,
|
|||
|
||||
// If one of the positions is at a space and the other isn't, chomp up 'til
|
||||
// the end of the space.
|
||||
while (isspace(static_cast<unsigned char>(*F1P)) && F1P != F1End)
|
||||
while (isSpace(static_cast<unsigned char>(*F1P)) && F1P != F1End)
|
||||
++F1P;
|
||||
while (isspace(static_cast<unsigned char>(*F2P)) && F2P != F2End)
|
||||
while (isSpace(static_cast<unsigned char>(*F2P)) && F2P != F2End)
|
||||
++F2P;
|
||||
|
||||
// If we stop on numbers, compare their difference.
|
||||
|
|
|
@ -945,7 +945,7 @@ bool HexagonAsmParser::isLabel(AsmToken &Token) {
|
|||
StringRef Raw(String.data(), Third.getString().data() - String.data() +
|
||||
Third.getString().size());
|
||||
std::string Collapsed = std::string(Raw);
|
||||
Collapsed.erase(llvm::remove_if(Collapsed, isspace), Collapsed.end());
|
||||
Collapsed.erase(llvm::remove_if(Collapsed, isSpace), Collapsed.end());
|
||||
StringRef Whole = Collapsed;
|
||||
std::pair<StringRef, StringRef> DotSplit = Whole.split('.');
|
||||
if (!matchRegister(DotSplit.first.lower()))
|
||||
|
@ -997,7 +997,7 @@ OperandMatchResultTy HexagonAsmParser::tryParseRegister(unsigned &RegNo,
|
|||
NeededWorkaround = NeededWorkaround || (Again && !(Contigious && Type));
|
||||
}
|
||||
std::string Collapsed = std::string(RawString);
|
||||
Collapsed.erase(llvm::remove_if(Collapsed, isspace), Collapsed.end());
|
||||
Collapsed.erase(llvm::remove_if(Collapsed, isSpace), Collapsed.end());
|
||||
StringRef FullString = Collapsed;
|
||||
std::pair<StringRef, StringRef> DotSplit = FullString.split('.');
|
||||
unsigned DotReg = matchRegister(DotSplit.first.lower());
|
||||
|
|
|
@ -1758,7 +1758,7 @@ unsigned HexagonInstrInfo::getInlineAsmLength(const char *Str,
|
|||
if (*Str == '\n' || strncmp(Str, MAI.getSeparatorString(),
|
||||
strlen(MAI.getSeparatorString())) == 0)
|
||||
atInsnStart = true;
|
||||
if (atInsnStart && !std::isspace(static_cast<unsigned char>(*Str))) {
|
||||
if (atInsnStart && !isSpace(static_cast<unsigned char>(*Str))) {
|
||||
Length += MaxInstLength;
|
||||
atInsnStart = false;
|
||||
}
|
||||
|
|
|
@ -208,6 +208,7 @@
|
|||
///===----------------------------------------------------------------------===//
|
||||
|
||||
#include "WebAssembly.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/IR/DebugInfoMetadata.h"
|
||||
#include "llvm/IR/Dominators.h"
|
||||
#include "llvm/IR/IRBuilder.h"
|
||||
|
@ -337,7 +338,7 @@ static std::string getSignature(FunctionType *FTy) {
|
|||
if (FTy->isVarArg())
|
||||
OS << "_...";
|
||||
Sig = OS.str();
|
||||
Sig.erase(remove_if(Sig, isspace), Sig.end());
|
||||
Sig.erase(remove_if(Sig, isSpace), Sig.end());
|
||||
// When s2wasm parses .s file, a comma means the end of an argument. So a
|
||||
// mangled function name can contain any character but a comma.
|
||||
std::replace(Sig.begin(), Sig.end(), ',', '.');
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
//===---------------------------------------------------------------------===//
|
||||
|
||||
#include "ResourceScriptToken.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
@ -201,7 +202,7 @@ bool Tokenizer::advance(size_t Amount) {
|
|||
}
|
||||
|
||||
bool Tokenizer::skipWhitespaces() {
|
||||
while (!streamEof() && std::isspace(Data[Pos]))
|
||||
while (!streamEof() && isSpace(Data[Pos]))
|
||||
advance();
|
||||
return !streamEof();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue