File tree Expand file tree Collapse file tree 2 files changed +10
-26
lines changed
Expand file tree Collapse file tree 2 files changed +10
-26
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,9 @@ namespace clang {
3939namespace replace {
4040
4141namespace detail {
42+
43+ static constexpr std::array<StringRef, 3 > AllowedExtensions = {" .yaml" , " .yml" , " " };
44+
4245template <typename TranslationUnits>
4346static 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
Original file line number Diff line number Diff 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
149130void 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(
315296namespace NS {
316297void unrelated();
317298void foo();
@@ -321,7 +302,7 @@ auto L = [] {
321302 using NS::unrelated;
322303 NS::f^oo();
323304};)cpp" ,
324- R"cpp(
305+ R"cpp(
325306namespace NS {
326307void unrelated();
327308void 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"
You can’t perform that action at this time.
0 commit comments