| 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 | (0) . __assert_fail ("!Name.empty() && \"Invalid symbol name!\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Tooling/Refactoring/Rename/SymbolName.h", 35, __PRETTY_FUNCTION__))" file_link="../../../../../../include/assert.h.html#88" macro="true">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: |
| 42 | llvm::SmallVector<std::string, 1> Name; |
| 43 | }; |
| 44 | |
| 45 | } // end namespace tooling |
| 46 | } // end namespace clang |
| 47 | |
| 48 | #endif // LLVM_CLANG_TOOLING_REFACTOR_RENAME_SYMBOL_NAME_H |
| 49 |