28
28
29
29
using clang::format::FormatStyle;
30
30
31
- LLVM_YAML_IS_SEQUENCE_VECTOR(clang::format:: FormatStyle::RawStringFormat)
31
+ LLVM_YAML_IS_SEQUENCE_VECTOR(FormatStyle::RawStringFormat)
32
32
33
33
namespace llvm {
34
34
namespace yaml {
@@ -1235,7 +1235,7 @@ std::error_code make_error_code(ParseError e) {
1235
1235
return std::error_code(static_cast<int>(e), getParseCategory());
1236
1236
}
1237
1237
1238
- inline llvm::Error make_string_error(const llvm:: Twine &Message) {
1238
+ inline llvm::Error make_string_error(const Twine &Message) {
1239
1239
return llvm::make_error<llvm::StringError>(Message,
1240
1240
llvm::inconvertibleErrorCode());
1241
1241
}
@@ -2361,7 +2361,7 @@ class JavaScriptRequoter : public TokenAnalyzer {
2361
2361
// FIXME: handle error. For now, print error message and skip the
2362
2362
// replacement for release version.
2363
2363
if (Err) {
2364
- llvm::errs() << llvm:: toString(std::move(Err)) << "\n";
2364
+ llvm::errs() << toString(std::move(Err)) << "\n";
2365
2365
assert(false);
2366
2366
}
2367
2367
};
@@ -2802,7 +2802,7 @@ class Cleaner : public TokenAnalyzer {
2802
2802
// FIXME: better error handling. for now just print error message and skip
2803
2803
// for the release version.
2804
2804
if (Err) {
2805
- llvm::errs() << llvm:: toString(std::move(Err)) << "\n";
2805
+ llvm::errs() << toString(std::move(Err)) << "\n";
2806
2806
assert(false && "Fixes must not conflict!");
2807
2807
}
2808
2808
Idx = End + 1;
@@ -3074,7 +3074,7 @@ static void sortCppIncludes(const FormatStyle &Style,
3074
3074
llvm::to_vector<16>(llvm::seq<unsigned>(0, Includes.size()));
3075
3075
3076
3076
if (Style.SortIncludes == FormatStyle::SI_CaseInsensitive) {
3077
- llvm:: stable_sort(Indices, [&](unsigned LHSI, unsigned RHSI) {
3077
+ stable_sort(Indices, [&](unsigned LHSI, unsigned RHSI) {
3078
3078
const auto LHSFilenameLower = Includes[LHSI].Filename.lower();
3079
3079
const auto RHSFilenameLower = Includes[RHSI].Filename.lower();
3080
3080
return std::tie(Includes[LHSI].Priority, LHSFilenameLower,
@@ -3083,7 +3083,7 @@ static void sortCppIncludes(const FormatStyle &Style,
3083
3083
Includes[RHSI].Filename);
3084
3084
});
3085
3085
} else {
3086
- llvm:: stable_sort(Indices, [&](unsigned LHSI, unsigned RHSI) {
3086
+ stable_sort(Indices, [&](unsigned LHSI, unsigned RHSI) {
3087
3087
return std::tie(Includes[LHSI].Priority, Includes[LHSI].Filename) <
3088
3088
std::tie(Includes[RHSI].Priority, Includes[RHSI].Filename);
3089
3089
});
@@ -3115,7 +3115,7 @@ static void sortCppIncludes(const FormatStyle &Style,
3115
3115
// enough as additional newlines might be added or removed across #include
3116
3116
// blocks. This we handle below by generating the updated #include blocks and
3117
3117
// comparing it to the original.
3118
- if (Indices.size() == Includes.size() && llvm:: is_sorted(Indices) &&
3118
+ if (Indices.size() == Includes.size() && is_sorted(Indices) &&
3119
3119
Style.IncludeStyle.IncludeBlocks == tooling::IncludeStyle::IBS_Preserve) {
3120
3120
return;
3121
3121
}
@@ -3154,7 +3154,7 @@ static void sortCppIncludes(const FormatStyle &Style,
3154
3154
// FIXME: better error handling. For now, just skip the replacement for the
3155
3155
// release version.
3156
3156
if (Err) {
3157
- llvm::errs() << llvm:: toString(std::move(Err)) << "\n";
3157
+ llvm::errs() << toString(std::move(Err)) << "\n";
3158
3158
assert(false);
3159
3159
}
3160
3160
}
@@ -3307,7 +3307,7 @@ static void sortJavaImports(const FormatStyle &Style,
3307
3307
3308
3308
bool StaticImportAfterNormalImport =
3309
3309
Style.SortJavaStaticImport == FormatStyle::SJSIO_After;
3310
- llvm:: sort(Indices, [&](unsigned LHSI, unsigned RHSI) {
3310
+ sort(Indices, [&](unsigned LHSI, unsigned RHSI) {
3311
3311
// Negating IsStatic to push static imports above non-static imports.
3312
3312
return std::make_tuple(!Imports[LHSI].IsStatic ^
3313
3313
StaticImportAfterNormalImport,
@@ -3357,7 +3357,7 @@ static void sortJavaImports(const FormatStyle &Style,
3357
3357
// FIXME: better error handling. For now, just skip the replacement for the
3358
3358
// release version.
3359
3359
if (Err) {
3360
- llvm::errs() << llvm:: toString(std::move(Err)) << "\n";
3360
+ llvm::errs() << toString(std::move(Err)) << "\n";
3361
3361
assert(false);
3362
3362
}
3363
3363
}
@@ -3451,7 +3451,7 @@ tooling::Replacements sortIncludes(const FormatStyle &Style, StringRef Code,
3451
3451
}
3452
3452
3453
3453
template <typename T>
3454
- static llvm:: Expected<tooling::Replacements>
3454
+ static Expected<tooling::Replacements>
3455
3455
processReplacements(T ProcessFunc, StringRef Code,
3456
3456
const tooling::Replacements &Replaces,
3457
3457
const FormatStyle &Style) {
@@ -3470,7 +3470,7 @@ processReplacements(T ProcessFunc, StringRef Code,
3470
3470
return Replaces.merge(FormatReplaces);
3471
3471
}
3472
3472
3473
- llvm:: Expected<tooling::Replacements>
3473
+ Expected<tooling::Replacements>
3474
3474
formatReplacements(StringRef Code, const tooling::Replacements &Replaces,
3475
3475
const FormatStyle &Style) {
3476
3476
// We need to use lambda function here since there are two versions of
@@ -3515,21 +3515,21 @@ fixCppIncludeInsertions(StringRef Code, const tooling::Replacements &Replaces,
3515
3515
return Replaces;
3516
3516
3517
3517
tooling::Replacements HeaderInsertions;
3518
- std::set<llvm:: StringRef> HeadersToDelete;
3518
+ std::set<StringRef> HeadersToDelete;
3519
3519
tooling::Replacements Result;
3520
3520
for (const auto &R : Replaces) {
3521
3521
if (isHeaderInsertion(R)) {
3522
3522
// Replacements from \p Replaces must be conflict-free already, so we can
3523
3523
// simply consume the error.
3524
- llvm:: consumeError(HeaderInsertions.add(R));
3524
+ consumeError(HeaderInsertions.add(R));
3525
3525
} else if (isHeaderDeletion(R)) {
3526
3526
HeadersToDelete.insert(R.getReplacementText());
3527
3527
} else if (R.getOffset() == UINT_MAX) {
3528
3528
llvm::errs() << "Insertions other than header #include insertion are "
3529
3529
"not supported! "
3530
3530
<< R.getReplacementText() << "\n";
3531
3531
} else {
3532
- llvm:: consumeError(Result.add(R));
3532
+ consumeError(Result.add(R));
3533
3533
}
3534
3534
}
3535
3535
if (HeaderInsertions.empty() && HeadersToDelete.empty())
@@ -3546,13 +3546,12 @@ fixCppIncludeInsertions(StringRef Code, const tooling::Replacements &Replaces,
3546
3546
if (Err) {
3547
3547
// Ignore the deletion on conflict.
3548
3548
llvm::errs() << "Failed to add header deletion replacement for "
3549
- << Header << ": " << llvm::toString(std::move(Err))
3550
- << "\n";
3549
+ << Header << ": " << toString(std::move(Err)) << "\n";
3551
3550
}
3552
3551
}
3553
3552
}
3554
3553
3555
- llvm:: SmallVector<StringRef, 4> Matches;
3554
+ SmallVector<StringRef, 4> Matches;
3556
3555
for (const auto &R : HeaderInsertions) {
3557
3556
auto IncludeDirective = R.getReplacementText();
3558
3557
bool Matched =
@@ -3567,7 +3566,7 @@ fixCppIncludeInsertions(StringRef Code, const tooling::Replacements &Replaces,
3567
3566
if (Replace) {
3568
3567
auto Err = Result.add(*Replace);
3569
3568
if (Err) {
3570
- llvm:: consumeError(std::move(Err));
3569
+ consumeError(std::move(Err));
3571
3570
unsigned NewOffset =
3572
3571
Result.getShiftedCodePosition(Replace->getOffset());
3573
3572
auto Shifted = tooling::Replacement(FileName, NewOffset, 0,
@@ -3581,7 +3580,7 @@ fixCppIncludeInsertions(StringRef Code, const tooling::Replacements &Replaces,
3581
3580
3582
3581
} // anonymous namespace
3583
3582
3584
- llvm:: Expected<tooling::Replacements>
3583
+ Expected<tooling::Replacements>
3585
3584
cleanupAroundReplacements(StringRef Code, const tooling::Replacements &Replaces,
3586
3585
const FormatStyle &Style) {
3587
3586
// We need to use lambda function here since there are two versions of
@@ -3774,7 +3773,7 @@ reformat(const FormatStyle &Style, StringRef Code,
3774
3773
auto Err = NonNoOpFixes.add(Fix);
3775
3774
if (Err) {
3776
3775
llvm::errs() << "Error adding replacements : "
3777
- << llvm:: toString(std::move(Err)) << "\n";
3776
+ << toString(std::move(Err)) << "\n";
3778
3777
}
3779
3778
}
3780
3779
}
@@ -3956,17 +3955,16 @@ loadAndParseConfigFile(StringRef ConfigFile, llvm::vfs::FileSystem *FS,
3956
3955
return Text;
3957
3956
}
3958
3957
3959
- llvm:: Expected<FormatStyle> getStyle(StringRef StyleName, StringRef FileName,
3960
- StringRef FallbackStyleName ,
3961
- StringRef Code, llvm::vfs::FileSystem *FS,
3962
- bool AllowUnknownOptions) {
3958
+ Expected<FormatStyle> getStyle(StringRef StyleName, StringRef FileName,
3959
+ StringRef FallbackStyleName, StringRef Code ,
3960
+ llvm::vfs::FileSystem *FS,
3961
+ bool AllowUnknownOptions) {
3963
3962
FormatStyle Style = getLLVMStyle(guessLanguage(FileName, Code));
3964
3963
FormatStyle FallbackStyle = getNoStyle();
3965
3964
if (!getPredefinedStyle(FallbackStyleName, Style.Language, &FallbackStyle))
3966
3965
return make_string_error("Invalid fallback style: " + FallbackStyleName);
3967
3966
3968
- llvm::SmallVector<std::unique_ptr<llvm::MemoryBuffer>, 1>
3969
- ChildFormatTextToApply;
3967
+ SmallVector<std::unique_ptr<llvm::MemoryBuffer>, 1> ChildFormatTextToApply;
3970
3968
3971
3969
if (StyleName.starts_with("{")) {
3972
3970
// Parse YAML/JSON style from the command line.
@@ -4041,7 +4039,7 @@ llvm::Expected<FormatStyle> getStyle(StringRef StyleName, StringRef FileName,
4041
4039
};
4042
4040
4043
4041
// Look for .clang-format/_clang-format file in the file's parent directories.
4044
- llvm:: SmallVector<std::string, 2> FilesToLookFor;
4042
+ SmallVector<std::string, 2> FilesToLookFor;
4045
4043
FilesToLookFor.push_back(".clang-format");
4046
4044
FilesToLookFor.push_back("_clang-format");
4047
4045
0 commit comments