Skip to content

Commit c16cc28

Browse files
author
Sukhmani
committed
added support for the .yml file extension
1 parent ed833d4 commit c16cc28

File tree

2 files changed

+10
-26
lines changed

2 files changed

+10
-26
lines changed

clang-tools-extra/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ namespace clang {
3939
namespace replace {
4040

4141
namespace detail {
42+
43+
static constexpr std::array<StringRef, 3> AllowedExtensions = {".yaml", ".yml", ""};
44+
4245
template <typename TranslationUnits>
4346
static std::error_code collectReplacementsFromDirectory(
4447
const llvm::StringRef Directory, TranslationUnits &TUs,
@@ -56,9 +59,9 @@ static std::error_code collectReplacementsFromDirectory(
5659
continue;
5760
}
5861

59-
if (extension(I->path()) != ".yaml")
62+
if (!is_contained(AllowedExtensions, extension(I->path())))
6063
continue;
61-
64+
6265
TUFiles.push_back(I->path());
6366

6467
ErrorOr<std::unique_ptr<MemoryBuffer>> Out =
@@ -268,4 +271,4 @@ bool deleteReplacementFiles(const TUReplacementFiles &Files,
268271
}
269272

270273
} // end namespace replace
271-
} // end namespace clang
274+
} // end namespace clang

clang-tools-extra/clangd/unittests/tweaks/AddUsingTests.cpp

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ class cc {
4444
};
4545
}
4646
})cpp";
47-
48-
EXPECT_AVAILABLE(Header + "void fun() { o^n^e^:^:^t^w^o^:^:^f^f(); }");
47+
EXPECT_AVAILABLE(Header + "void fun() { o^n^e^:^:^t^w^o^:^:^f^f(); }");
4948
EXPECT_AVAILABLE(Header + "void fun() { o^n^e^::^o^o(); }");
5049
EXPECT_AVAILABLE(Header + "void fun() { o^n^e^:^:^t^w^o^:^:^e^e E; }");
5150
EXPECT_AVAILABLE(Header + "void fun() { o^n^e^:^:^t^w^o:^:^c^c C; }");
@@ -127,24 +126,6 @@ void fun() {
127126
{
128127
R"cpp(
129128
#include "test.hpp"
130-
namespace {
131-
void fun() {
132-
::one::t^wo::cc inst;
133-
}
134-
})cpp",
135-
R"cpp(
136-
#include "test.hpp"
137-
namespace {using ::one::two::cc;
138-
139-
void fun() {
140-
cc inst;
141-
}
142-
})cpp",
143-
},
144-
// Type, no other using, no namespace.
145-
{
146-
R"cpp(
147-
#include "test.hpp"
148129
149130
void fun() {
150131
one::two::e^e inst;
@@ -311,7 +292,7 @@ void foo::fun() {
311292
})cpp"},
312293
// Inside a lambda.
313294
{
314-
R"cpp(
295+
R"cpp(
315296
namespace NS {
316297
void unrelated();
317298
void foo();
@@ -321,7 +302,7 @@ auto L = [] {
321302
using NS::unrelated;
322303
NS::f^oo();
323304
};)cpp",
324-
R"cpp(
305+
R"cpp(
325306
namespace NS {
326307
void unrelated();
327308
void foo();
@@ -331,7 +312,7 @@ auto L = [] {
331312
using NS::foo;using NS::unrelated;
332313
foo();
333314
};)cpp",
334-
},
315+
},
335316
// If all other using are fully qualified, add ::
336317
{R"cpp(
337318
#include "test.hpp"

0 commit comments

Comments
 (0)