Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:37:11

0001 //===--- SymbolName.h - Clang refactoring library -------------------------===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLVM_CLANG_TOOLING_REFACTORING_RENAME_SYMBOLNAME_H
0010 #define LLVM_CLANG_TOOLING_REFACTORING_RENAME_SYMBOLNAME_H
0011 
0012 #include "clang/Basic/LLVM.h"
0013 #include "llvm/ADT/ArrayRef.h"
0014 #include "llvm/ADT/SmallVector.h"
0015 #include "llvm/ADT/StringRef.h"
0016 
0017 namespace clang {
0018 namespace tooling {
0019 
0020 /// A name of a symbol.
0021 ///
0022 /// Symbol's name can be composed of multiple strings. For example, Objective-C
0023 /// methods can contain multiple argument labels:
0024 ///
0025 /// \code
0026 /// - (void) myMethodNamePiece: (int)x anotherNamePieces:(int)y;
0027 /// //       ^~ string 0 ~~~~~         ^~ string 1 ~~~~~
0028 /// \endcode
0029 class SymbolName {
0030 public:
0031   explicit SymbolName(StringRef Name) {
0032     // While empty symbol names are valid (Objective-C selectors can have empty
0033     // name pieces), occurrences Objective-C selectors are created using an
0034     // array of strings instead of just one string.
0035     assert(!Name.empty() && "Invalid symbol name!");
0036     this->Name.push_back(Name.str());
0037   }
0038 
0039   ArrayRef<std::string> getNamePieces() const { return Name; }
0040 
0041 private:
0042   llvm::SmallVector<std::string, 1> Name;
0043 };
0044 
0045 } // end namespace tooling
0046 } // end namespace clang
0047 
0048 #endif // LLVM_CLANG_TOOLING_REFACTORING_RENAME_SYMBOLNAME_H