clang 20.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_REFACTORING_RENAME_SYMBOLNAME_H
10#define LLVM_CLANG_TOOLING_REFACTORING_RENAME_SYMBOLNAME_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
17namespace clang {
18namespace 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
30public:
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
41private:
43};
44
45} // end namespace tooling
46} // end namespace clang
47
48#endif // LLVM_CLANG_TOOLING_REFACTORING_RENAME_SYMBOLNAME_H
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
A name of a symbol.
Definition: SymbolName.h:29
SymbolName(StringRef Name)
Definition: SymbolName.h:31
ArrayRef< std::string > getNamePieces() const
Definition: SymbolName.h:39
The JSON file list parser is used to communicate input to InstallAPI.