1 //===--- SymbolName.h - Clang refactoring library -------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_CLANG_TOOLING_REFACTOR_RENAME_SYMBOL_NAME_H
11 #define LLVM_CLANG_TOOLING_REFACTOR_RENAME_SYMBOL_NAME_H
13 #include "clang/Basic/LLVM.h"
14 #include "llvm/ADT/ArrayRef.h"
15 #include "llvm/ADT/SmallVector.h"
16 #include "llvm/ADT/StringRef.h"
21 /// A name of a symbol.
23 /// Symbol's name can be composed of multiple strings. For example, Objective-C
24 /// methods can contain multiple argument labels:
27 /// - (void) myMethodNamePiece: (int)x anotherNamePieces:(int)y;
28 /// // ^~ string 0 ~~~~~ ^~ string 1 ~~~~~
32 explicit SymbolName(StringRef Name) {
33 // While empty symbol names are valid (Objective-C selectors can have empty
34 // name pieces), occurrences Objective-C selectors are created using an
35 // array of strings instead of just one string.
36 assert(!Name.empty() && "Invalid symbol name!");
37 this->Name.push_back(Name.str());
40 ArrayRef<std::string> getNamePieces() const { return Name; }
43 llvm::SmallVector<std::string, 1> Name;
46 } // end namespace tooling
47 } // end namespace clang
49 #endif // LLVM_CLANG_TOOLING_REFACTOR_RENAME_SYMBOL_NAME_H