• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===-- OptionsUtils.cpp - clang-tidy -------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "OptionsUtils.h"
10 
11 namespace clang {
12 namespace tidy {
13 namespace utils {
14 namespace options {
15 
16 static const char StringsDelimiter[] = ";";
17 
parseStringList(StringRef Option)18 std::vector<std::string> parseStringList(StringRef Option) {
19   SmallVector<StringRef, 4> Names;
20   Option.split(Names, StringsDelimiter);
21   std::vector<std::string> Result;
22   for (StringRef &Name : Names) {
23     Name = Name.trim();
24     if (!Name.empty())
25       Result.emplace_back(Name);
26   }
27   return Result;
28 }
29 
serializeStringList(ArrayRef<std::string> Strings)30 std::string serializeStringList(ArrayRef<std::string> Strings) {
31   return llvm::join(Strings, StringsDelimiter);
32 }
33 
34 } // namespace options
35 } // namespace utils
36 } // namespace tidy
37 } // namespace clang
38