clang-tools  7.0.0
OptionsUtils.cpp
Go to the documentation of this file.
1 //===--- DanglingHandleCheck.cpp - clang-tidy------------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #include "OptionsUtils.h"
11 
12 namespace clang {
13 namespace tidy {
14 namespace utils {
15 namespace options {
16 
17 static const char StringsDelimiter[] = ";";
18 
19 std::vector<std::string> parseStringList(StringRef Option) {
20  SmallVector<StringRef, 4> Names;
21  Option.split(Names, StringsDelimiter);
22  std::vector<std::string> Result;
23  for (StringRef &Name : Names) {
24  Name = Name.trim();
25  if (!Name.empty())
26  Result.push_back(Name);
27  }
28  return Result;
29 }
30 
31 std::string serializeStringList(ArrayRef<std::string> Strings) {
32  return llvm::join(Strings.begin(), Strings.end(), StringsDelimiter);
33 }
34 
35 } // namespace options
36 } // namespace utils
37 } // namespace tidy
38 } // namespace clang
llvm::StringRef Name
std::string serializeStringList(ArrayRef< std::string > Strings)
Serialize a sequence of names that can be parsed by parseStringList.
static const char StringsDelimiter[]
std::vector< std::string > parseStringList(StringRef Option)
Parse a semicolon separated list of strings.
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
static std::string join(ArrayRef< SpecialMemberFunctionsCheck::SpecialMemberFunctionKind > SMFS, llvm::StringRef AndOr)