clang  14.0.0git
SymbolName.h
Go to the documentation of this file.
1 //===--- SymbolName.h - Clang refactoring library -------------------------===//
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 #ifndef LLVM_CLANG_TOOLING_REFACTOR_RENAME_SYMBOL_NAME_H
10 #define LLVM_CLANG_TOOLING_REFACTOR_RENAME_SYMBOL_NAME_H
11 
12 #include "clang/Basic/LLVM.h"
13 #include "llvm/ADT/ArrayRef.h"
14 #include "llvm/ADT/SmallVector.h"
15 #include "llvm/ADT/StringRef.h"
16 
17 namespace clang {
18 namespace tooling {
19 
20 /// A name of a symbol.
21 ///
22 /// Symbol's name can be composed of multiple strings. For example, Objective-C
23 /// methods can contain multiple argument labels:
24 ///
25 /// \code
26 /// - (void) myMethodNamePiece: (int)x anotherNamePieces:(int)y;
27 /// // ^~ string 0 ~~~~~ ^~ string 1 ~~~~~
28 /// \endcode
29 class SymbolName {
30 public:
31  explicit SymbolName(StringRef Name) {
32  // While empty symbol names are valid (Objective-C selectors can have empty
33  // name pieces), occurrences Objective-C selectors are created using an
34  // array of strings instead of just one string.
35  assert(!Name.empty() && "Invalid symbol name!");
36  this->Name.push_back(Name.str());
37  }
38 
39  ArrayRef<std::string> getNamePieces() const { return Name; }
40 
41 private:
43 };
44 
45 } // end namespace tooling
46 } // end namespace clang
47 
48 #endif // LLVM_CLANG_TOOLING_REFACTOR_RENAME_SYMBOL_NAME_H
llvm::SmallVector< std::string, 1 >
clang::tooling::SymbolName::SymbolName
SymbolName(StringRef Name)
Definition: SymbolName.h:31
llvm::ArrayRef< std::string >
LLVM.h
clang::tooling::SymbolName
A name of a symbol.
Definition: SymbolName.h:29
clang
Definition: CalledOnceCheck.h:17
clang::tooling::SymbolName::getNamePieces
ArrayRef< std::string > getNamePieces() const
Definition: SymbolName.h:39