//===- CXString.cpp - Routines for manipulating CXStrings -----------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file defines routines for manipulating CXStrings. It should be the // only file that has internal knowledge of the encoding of the data in // CXStrings. // //===----------------------------------------------------------------------===// #include "CXString.h" #include "CXTranslationUnit.h" #include "clang-c/Index.h" #include "clang/Frontend/ASTUnit.h" #include "llvm/Support/ErrorHandling.h" usingnamespaceclang; /// Describes the kind of underlying data in CXString. enum CXStringFlag { … }; namespace clang { namespace cxstring { //===----------------------------------------------------------------------===// // Basic generation of CXStrings. //===----------------------------------------------------------------------===// CXString createEmpty() { … } CXString createNull() { … } CXString createRef(const char *String) { … } CXString createDup(const char *String) { … } CXString createRef(StringRef String) { … } CXString createDup(StringRef String) { … } CXString createCXString(CXStringBuf *buf) { … } CXStringSet *createSet(const std::vector<std::string> &Strings) { … } //===----------------------------------------------------------------------===// // String pools. //===----------------------------------------------------------------------===// CXStringPool::~CXStringPool() { … } CXStringBuf *CXStringPool::getCXStringBuf(CXTranslationUnit TU) { … } CXStringBuf *getCXStringBuf(CXTranslationUnit TU) { … } void CXStringBuf::dispose() { … } bool isManagedByPool(CXString str) { … } } // end namespace cxstring } // end namespace clang //===----------------------------------------------------------------------===// // libClang public APIs. //===----------------------------------------------------------------------===// const char *clang_getCString(CXString string) { … } void clang_disposeString(CXString string) { … } void clang_disposeStringSet(CXStringSet *set) { … }