mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-27 15:41:46 +00:00
[clang] Use range-based for loops with llvm::reverse (NFC)
This commit is contained in:
parent
972219195e
commit
74115602e8
@ -223,9 +223,7 @@ static SanitizerMask parseSanitizeTrapArgs(const Driver &D,
|
||||
SanitizerMask TrappingKinds;
|
||||
SanitizerMask TrappingSupportedWithGroups = setGroupBits(TrappingSupported);
|
||||
|
||||
for (ArgList::const_reverse_iterator I = Args.rbegin(), E = Args.rend();
|
||||
I != E; ++I) {
|
||||
const auto *Arg = *I;
|
||||
for (const llvm::opt::Arg *Arg : llvm::reverse(Args)) {
|
||||
if (Arg->getOption().matches(options::OPT_fsanitize_trap_EQ)) {
|
||||
Arg->claim();
|
||||
SanitizerMask Add = parseArgValues(D, Arg, true);
|
||||
@ -322,9 +320,7 @@ SanitizerArgs::SanitizerArgs(const ToolChain &TC,
|
||||
bool RemoveObjectSizeAtO0 =
|
||||
!OptLevel || OptLevel->getOption().matches(options::OPT_O0);
|
||||
|
||||
for (ArgList::const_reverse_iterator I = Args.rbegin(), E = Args.rend();
|
||||
I != E; ++I) {
|
||||
const auto *Arg = *I;
|
||||
for (const llvm::opt::Arg *Arg : llvm::reverse(Args)) {
|
||||
if (Arg->getOption().matches(options::OPT_fsanitize_EQ)) {
|
||||
Arg->claim();
|
||||
SanitizerMask Add = parseArgValues(D, Arg, DiagnoseErrors);
|
||||
@ -349,7 +345,7 @@ SanitizerArgs::SanitizerArgs(const ToolChain &TC,
|
||||
if (SanitizerMask KindsToDiagnose =
|
||||
Add & InvalidTrappingKinds & ~DiagnosedKinds) {
|
||||
if (DiagnoseErrors) {
|
||||
std::string Desc = describeSanitizeArg(*I, KindsToDiagnose);
|
||||
std::string Desc = describeSanitizeArg(Arg, KindsToDiagnose);
|
||||
D.Diag(diag::err_drv_argument_not_allowed_with)
|
||||
<< Desc << "-fsanitize-trap=undefined";
|
||||
}
|
||||
@ -361,7 +357,7 @@ SanitizerArgs::SanitizerArgs(const ToolChain &TC,
|
||||
if (SanitizerMask KindsToDiagnose =
|
||||
Add & NotAllowedWithMinimalRuntime & ~DiagnosedKinds) {
|
||||
if (DiagnoseErrors) {
|
||||
std::string Desc = describeSanitizeArg(*I, KindsToDiagnose);
|
||||
std::string Desc = describeSanitizeArg(Arg, KindsToDiagnose);
|
||||
D.Diag(diag::err_drv_argument_not_allowed_with)
|
||||
<< Desc << "-fsanitize-minimal-runtime";
|
||||
}
|
||||
@ -391,7 +387,7 @@ SanitizerArgs::SanitizerArgs(const ToolChain &TC,
|
||||
|
||||
if (SanitizerMask KindsToDiagnose = Add & ~Supported & ~DiagnosedKinds) {
|
||||
if (DiagnoseErrors) {
|
||||
std::string Desc = describeSanitizeArg(*I, KindsToDiagnose);
|
||||
std::string Desc = describeSanitizeArg(Arg, KindsToDiagnose);
|
||||
D.Diag(diag::err_drv_unsupported_opt_for_target)
|
||||
<< Desc << TC.getTriple().str();
|
||||
}
|
||||
|
@ -3429,11 +3429,9 @@ public:
|
||||
// Only emit declarations that aren't from a chained PCH, though.
|
||||
SmallVector<NamedDecl *, 16> Decls(IdResolver.begin(II),
|
||||
IdResolver.end());
|
||||
for (SmallVectorImpl<NamedDecl *>::reverse_iterator D = Decls.rbegin(),
|
||||
DEnd = Decls.rend();
|
||||
D != DEnd; ++D)
|
||||
for (NamedDecl *D : llvm::reverse(Decls))
|
||||
LE.write<uint32_t>(
|
||||
Writer.getDeclID(getDeclForLocalLookup(PP.getLangOpts(), *D)));
|
||||
Writer.getDeclID(getDeclForLocalLookup(PP.getLangOpts(), D)));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -383,16 +383,14 @@ void ModuleManager::visit(llvm::function_ref<bool(ModuleFile &M)> Visitor,
|
||||
|
||||
// For any module that this module depends on, push it on the
|
||||
// stack (if it hasn't already been marked as visited).
|
||||
for (auto M = CurrentModule->Imports.rbegin(),
|
||||
MEnd = CurrentModule->Imports.rend();
|
||||
M != MEnd; ++M) {
|
||||
for (ModuleFile *M : llvm::reverse(CurrentModule->Imports)) {
|
||||
// Remove our current module as an impediment to visiting the
|
||||
// module we depend on. If we were the last unvisited module
|
||||
// that depends on this particular module, push it into the
|
||||
// queue to be visited.
|
||||
unsigned &NumUnusedEdges = UnusedIncomingEdges[(*M)->Index];
|
||||
unsigned &NumUnusedEdges = UnusedIncomingEdges[M->Index];
|
||||
if (NumUnusedEdges && (--NumUnusedEdges == 0))
|
||||
Queue.push_back(*M);
|
||||
Queue.push_back(M);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -393,8 +393,7 @@ ProgramStateRef ExprEngine::createTemporaryRegionIfNeeded(
|
||||
SVal BaseReg = Reg;
|
||||
|
||||
// Make the necessary adjustments to obtain the sub-object.
|
||||
for (auto I = Adjustments.rbegin(), E = Adjustments.rend(); I != E; ++I) {
|
||||
const SubobjectAdjustment &Adj = *I;
|
||||
for (const SubobjectAdjustment &Adj : llvm::reverse(Adjustments)) {
|
||||
switch (Adj.Kind) {
|
||||
case SubobjectAdjustment::DerivedToBaseAdjustment:
|
||||
Reg = StoreMgr.evalDerivedToBase(Reg, Adj.DerivedToBase.BasePath);
|
||||
|
@ -757,9 +757,8 @@ void ExprEngine::VisitInitListExpr(const InitListExpr *IE,
|
||||
return;
|
||||
}
|
||||
|
||||
for (InitListExpr::const_reverse_iterator it = IE->rbegin(),
|
||||
ei = IE->rend(); it != ei; ++it) {
|
||||
SVal V = state->getSVal(cast<Expr>(*it), LCtx);
|
||||
for (const Stmt *S : llvm::reverse(*IE)) {
|
||||
SVal V = state->getSVal(cast<Expr>(S), LCtx);
|
||||
vals = getBasicVals().prependSVal(V, vals);
|
||||
}
|
||||
|
||||
|
@ -792,8 +792,8 @@ void HTMLDiagnostics::RewriteFile(Rewriter &R, const PathPieces &path,
|
||||
|
||||
// Stores the different ranges where we have reported something.
|
||||
std::vector<SourceRange> PopUpRanges;
|
||||
for (auto I = path.rbegin(), E = path.rend(); I != E; ++I) {
|
||||
const auto &Piece = *I->get();
|
||||
for (const PathDiagnosticPieceRef &I : llvm::reverse(path)) {
|
||||
const auto &Piece = *I.get();
|
||||
|
||||
if (isa<PathDiagnosticPopUpPiece>(Piece)) {
|
||||
++IndexMap[NumRegularPieces];
|
||||
@ -835,8 +835,8 @@ void HTMLDiagnostics::RewriteFile(Rewriter &R, const PathPieces &path,
|
||||
// Secondary indexing if we are having multiple pop-ups between two notes.
|
||||
// (e.g. [(13) 'a' is 'true']; [(13.1) 'b' is 'false']; [(13.2) 'c' is...)
|
||||
NumRegularPieces = TotalRegularPieces;
|
||||
for (auto I = path.rbegin(), E = path.rend(); I != E; ++I) {
|
||||
const auto &Piece = *I->get();
|
||||
for (const PathDiagnosticPieceRef &I : llvm::reverse(path)) {
|
||||
const auto &Piece = *I.get();
|
||||
|
||||
if (const auto *PopUpP = dyn_cast<PathDiagnosticPopUpPiece>(&Piece)) {
|
||||
int PopUpPieceIndex = IndexMap[NumRegularPieces];
|
||||
|
Loading…
Reference in New Issue
Block a user