Skip to content

Commit 7c6635b

Browse files
authored
merge main into amd-staging (llvm#2642)
2 parents 2dde234 + 97ef8bc commit 7c6635b

38 files changed

+271
-281
lines changed

clang-tools-extra/modularize/CoverageChecker.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,10 +329,8 @@ bool CoverageChecker::collectFileSystemHeaders() {
329329
else {
330330
// Otherwise we only look at the sub-trees specified by the
331331
// include paths.
332-
for (std::vector<std::string>::const_iterator I = IncludePaths.begin(),
333-
E = IncludePaths.end();
334-
I != E; ++I) {
335-
if (!collectFileSystemHeaders(*I))
332+
for (const std::string &IncludePath : IncludePaths) {
333+
if (!collectFileSystemHeaders(IncludePath))
336334
return false;
337335
}
338336
}

clang-tools-extra/modularize/Modularize.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,8 @@ static std::string findInputFile(const CommandLineArguments &CLArgs) {
339339
llvm::opt::Visibility VisibilityMask(options::CC1Option);
340340
unsigned MissingArgIndex, MissingArgCount;
341341
SmallVector<const char *, 256> Argv;
342-
for (auto I = CLArgs.begin(), E = CLArgs.end(); I != E; ++I)
343-
Argv.push_back(I->c_str());
342+
for (const std::string &CLArg : CLArgs)
343+
Argv.push_back(CLArg.c_str());
344344
InputArgList Args = getDriverOptTable().ParseArgs(
345345
Argv, MissingArgIndex, MissingArgCount, VisibilityMask);
346346
std::vector<std::string> Inputs = Args.getAllArgValues(OPT_INPUT);

clang-tools-extra/modularize/ModularizeUtilities.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ ModularizeUtilities *ModularizeUtilities::createModularizeUtilities(
6969
// Load all header lists and dependencies.
7070
std::error_code ModularizeUtilities::loadAllHeaderListsAndDependencies() {
7171
// For each input file.
72-
for (auto I = InputFilePaths.begin(), E = InputFilePaths.end(); I != E; ++I) {
73-
llvm::StringRef InputPath = *I;
72+
for (llvm::StringRef InputPath : InputFilePaths) {
7473
// If it's a module map.
7574
if (InputPath.ends_with(".modulemap")) {
7675
// Load the module map.

clang/lib/AST/ByteCode/Compiler.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6591,10 +6591,6 @@ bool Compiler<Emitter>::visitDeclRef(const ValueDecl *D, const Expr *E) {
65916591
return T->isReferenceType();
65926592
};
65936593

6594-
// DecompositionDecls are just proxies for us.
6595-
if (isa<DecompositionDecl>(VD))
6596-
return revisit(VD);
6597-
65986594
if ((VD->hasGlobalStorage() || VD->isStaticDataMember()) &&
65996595
typeShouldBeVisited(VD->getType())) {
66006596
if (const Expr *Init = VD->getAnyInitializer();

clang/lib/Sema/SemaOverload.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9272,11 +9272,10 @@ class BuiltinOperatorOverloadBuilder {
92729272
/// the candidates into a unique set, then move from that set into the list
92739273
/// of arithmetic types.
92749274
llvm::SmallSetVector<CanQualType, 2> BitIntCandidates;
9275-
llvm::for_each(CandidateTypes, [&BitIntCandidates](
9276-
BuiltinCandidateTypeSet &Candidate) {
9275+
for (BuiltinCandidateTypeSet &Candidate : CandidateTypes) {
92779276
for (QualType BitTy : Candidate.bitint_types())
92789277
BitIntCandidates.insert(CanQualType::CreateUnsafe(BitTy));
9279-
});
9278+
}
92809279
llvm::move(BitIntCandidates, std::back_inserter(ArithmeticTypes));
92819280
LastPromotedIntegralType = ArithmeticTypes.size();
92829281
LastPromotedArithmeticType = ArithmeticTypes.size();

clang/test/AST/ByteCode/cxx17.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,3 +141,11 @@ template <int x> constexpr auto c() {
141141
}
142142

143143
auto y = c<1>(); // both-note {{in instantiation of function template specialization 'c<1>' requested here}}
144+
145+
namespace NonConstexprStructuredBinding {
146+
void f1() {
147+
int arr[2] = {};
148+
auto [a, b] = arr;
149+
static_assert(&a != &b);
150+
}
151+
}

clang/utils/TableGen/ClangCommentCommandInfoEmitter.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ void clang::EmitClangCommentCommandInfo(const RecordKeeper &Records,
7878

7979
static std::string MangleName(StringRef Str) {
8080
std::string Mangled;
81-
for (unsigned i = 0, e = Str.size(); i != e; ++i) {
82-
switch (Str[i]) {
81+
for (char C : Str) {
82+
switch (C) {
8383
default:
84-
Mangled += Str[i];
84+
Mangled += C;
8585
break;
8686
case '(':
8787
Mangled += "lparen";
@@ -122,9 +122,8 @@ void clang::EmitClangCommentCommandList(const RecordKeeper &Records,
122122
<< "#endif\n";
123123

124124
ArrayRef<const Record *> Tags = Records.getAllDerivedDefinitions("Command");
125-
for (size_t i = 0, e = Tags.size(); i != e; ++i) {
126-
const Record &Tag = *Tags[i];
127-
std::string MangledName = MangleName(Tag.getValueAsString("Name"));
125+
for (const Record *Tag : Tags) {
126+
std::string MangledName = MangleName(Tag->getValueAsString("Name"));
128127

129128
OS << "COMMENT_COMMAND(" << MangledName << ")\n";
130129
}

clang/utils/TableGen/ClangCommentHTMLNamedCharacterReferenceEmitter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ static bool translateCodePointToUTF8(unsigned CodePoint,
3737

3838
raw_svector_ostream OS(CLiteral);
3939
OS << "\"";
40-
for (size_t i = 0, e = UTF8.size(); i != e; ++i) {
40+
for (char C : UTF8) {
4141
OS << "\\x";
42-
OS.write_hex(static_cast<unsigned char>(UTF8[i]));
42+
OS.write_hex(static_cast<unsigned char>(C));
4343
}
4444
OS << "\"";
4545

clang/utils/TableGen/ClangDiagnosticsEmitter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1794,8 +1794,8 @@ static std::string getDiagCategoryEnum(StringRef name) {
17941794
if (name.empty())
17951795
return "DiagCat_None";
17961796
SmallString<256> enumName = StringRef("DiagCat_");
1797-
for (StringRef::iterator I = name.begin(), E = name.end(); I != E; ++I)
1798-
enumName += isalnum(*I) ? *I : '_';
1797+
for (char C : name)
1798+
enumName += isalnum(C) ? C : '_';
17991799
return std::string(enumName);
18001800
}
18011801

clang/utils/TableGen/ClangOpcodesEmitter.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,7 @@ void ClangOpcodesEmitter::EmitProto(raw_ostream &OS, StringRef N,
224224
auto Args = R->getValueAsListOfDefs("Args");
225225
Enumerate(R, N, [&OS, &Args](ArrayRef<const Record *> TS, const Twine &ID) {
226226
OS << "bool emit" << ID << "(";
227-
for (size_t I = 0, N = Args.size(); I < N; ++I) {
228-
const auto *Arg = Args[I];
227+
for (const Record *Arg : Args) {
229228
bool AsRef = Arg->getValueAsBit("AsRef");
230229
auto Name = Arg->getValueAsString("Name");
231230

0 commit comments

Comments
 (0)