2010-11-16 10:03:55 +08:00
|
|
|
//===- CXString.h - Routines for manipulating CXStrings -------------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file defines routines for manipulating CXStrings.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_CLANG_CXSTRING_H
|
|
|
|
#define LLVM_CLANG_CXSTRING_H
|
|
|
|
|
|
|
|
#include "clang-c/Index.h"
|
2011-07-20 14:58:45 +08:00
|
|
|
#include "clang/Basic/LLVM.h"
|
2010-11-16 10:03:55 +08:00
|
|
|
#include "llvm/ADT/StringRef.h"
|
2010-11-16 16:15:36 +08:00
|
|
|
#include "llvm/ADT/SmallString.h"
|
2010-11-16 10:03:55 +08:00
|
|
|
|
|
|
|
namespace clang {
|
|
|
|
namespace cxstring {
|
2010-11-16 16:15:36 +08:00
|
|
|
|
|
|
|
struct CXStringBuf {
|
|
|
|
llvm::SmallString<128> Data;
|
|
|
|
CXTranslationUnit TU;
|
|
|
|
CXStringBuf(CXTranslationUnit tu) : TU(tu) {}
|
|
|
|
};
|
2010-11-16 10:03:55 +08:00
|
|
|
|
|
|
|
/// \brief Create a CXString object from a C string.
|
|
|
|
CXString createCXString(const char *String, bool DupString = false);
|
|
|
|
|
2010-11-16 16:15:36 +08:00
|
|
|
/// \brief Create a CXString object from a StringRef.
|
2011-07-20 14:58:45 +08:00
|
|
|
CXString createCXString(StringRef String, bool DupString = true);
|
2010-11-16 16:15:36 +08:00
|
|
|
|
|
|
|
/// \brief Create a CXString object that is backed by a string buffer.
|
|
|
|
CXString createCXString(CXStringBuf *buf);
|
|
|
|
|
|
|
|
/// \brief Create an opaque string pool used for fast geneneration of strings.
|
|
|
|
void *createCXStringPool();
|
|
|
|
|
|
|
|
/// \brief Dispose of a string pool.
|
|
|
|
void disposeCXStringPool(void *pool);
|
|
|
|
|
|
|
|
CXStringBuf *getCXStringBuf(CXTranslationUnit TU);
|
|
|
|
|
|
|
|
void disposeCXStringBuf(CXStringBuf *buf);
|
2010-11-16 10:03:55 +08:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|