Skip to content

Commit b7c4ac2

Browse files
committed
NFC, use structured binding to simplify the code.
1 parent 6aa33ee commit b7c4ac2

File tree

5 files changed

+5
-15
lines changed

5 files changed

+5
-15
lines changed

clang/lib/Frontend/ASTUnit.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2466,9 +2466,7 @@ void ASTUnit::addFileLevelDecl(Decl *D) {
24662466

24672467
SourceLocation FileLoc = SM.getFileLoc(Loc);
24682468
assert(SM.isLocalSourceLocation(FileLoc));
2469-
FileID FID;
2470-
unsigned Offset;
2471-
std::tie(FID, Offset) = SM.getDecomposedLoc(FileLoc);
2469+
auto [FID, Offset] = SM.getDecomposedLoc(FileLoc);
24722470
if (FID.isInvalid())
24732471
return;
24742472

clang/lib/Lex/Lexer.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -929,9 +929,7 @@ static CharSourceRange makeRangeFromFileLocs(CharSourceRange Range,
929929
}
930930

931931
// Break down the source locations.
932-
FileID FID;
933-
unsigned BeginOffs;
934-
std::tie(FID, BeginOffs) = SM.getDecomposedLoc(Begin);
932+
auto [FID, BeginOffs] = SM.getDecomposedLoc(Begin);
935933
if (FID.isInvalid())
936934
return {};
937935

clang/lib/Serialization/ASTWriter.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6968,9 +6968,7 @@ void ASTWriter::associateDeclWithFile(const Decl *D, LocalDeclID ID) {
69686968
SourceManager &SM = PP->getSourceManager();
69696969
SourceLocation FileLoc = SM.getFileLoc(Loc);
69706970
assert(SM.isLocalSourceLocation(FileLoc));
6971-
FileID FID;
6972-
unsigned Offset;
6973-
std::tie(FID, Offset) = SM.getDecomposedLoc(FileLoc);
6971+
auto [FID, Offset] = SM.getDecomposedLoc(FileLoc);
69746972
if (FID.isInvalid())
69756973
return;
69766974
assert(SM.getSLocEntry(FID).isFile());

clang/tools/libclang/Indexing.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -389,9 +389,7 @@ class IndexingFrontendAction : public ASTFrontendAction {
389389
if (SM.isInSystemHeader(Loc))
390390
return true; // always skip bodies from system headers.
391391

392-
FileID FID;
393-
unsigned Offset;
394-
std::tie(FID, Offset) = SM.getDecomposedLoc(Loc);
392+
auto [FID, Offset] = SM.getDecomposedLoc(Loc);
395393
// Don't skip bodies from main files; this may be revisited.
396394
if (SM.getMainFileID() == FID)
397395
return false;

clang/unittests/Index/IndexTests.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ struct Position {
3535

3636
static Position fromSourceLocation(SourceLocation Loc,
3737
const SourceManager &SM) {
38-
FileID FID;
39-
unsigned Offset;
40-
std::tie(FID, Offset) = SM.getDecomposedSpellingLoc(Loc);
38+
auto [FID, Offset] = SM.getDecomposedSpellingLoc(Loc);
4139
Position P;
4240
P.Line = SM.getLineNumber(FID, Offset);
4341
P.Column = SM.getColumnNumber(FID, Offset);

0 commit comments

Comments
 (0)