#include "CIndexDiagnostic.h"
#include "CIndexer.h"
#include "CLog.h"
#include "CXCursor.h"
#include "CXSourceLocation.h"
#include "CXString.h"
#include "CXTranslationUnit.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/Type.h"
#include "clang/Basic/FileManager.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Frontend/ASTUnit.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/FrontendActions.h"
#include "clang/Sema/CodeCompleteConsumer.h"
#include "clang/Sema/Sema.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/CrashRecoveryContext.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Program.h"
#include "llvm/Support/Timer.h"
#include "llvm/Support/raw_ostream.h"
#include <atomic>
#include <cstdio>
#include <cstdlib>
#include <string>
#ifdef UDP_CODE_COMPLETION_LOGGER
#include "clang/Basic/Version.h"
#include <arpa/inet.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <unistd.h>
#endif
usingnamespaceclang;
usingnamespaceclang::cxindex;
enum CXCompletionChunkKind
clang_getCompletionChunkKind(CXCompletionString completion_string,
unsigned chunk_number) { … }
CXString clang_getCompletionChunkText(CXCompletionString completion_string,
unsigned chunk_number) { … }
CXCompletionString
clang_getCompletionChunkCompletionString(CXCompletionString completion_string,
unsigned chunk_number) { … }
unsigned clang_getNumCompletionChunks(CXCompletionString completion_string) { … }
unsigned clang_getCompletionPriority(CXCompletionString completion_string) { … }
enum CXAvailabilityKind
clang_getCompletionAvailability(CXCompletionString completion_string) { … }
unsigned clang_getCompletionNumAnnotations(CXCompletionString completion_string)
{ … }
CXString clang_getCompletionAnnotation(CXCompletionString completion_string,
unsigned annotation_number) { … }
CXString
clang_getCompletionParent(CXCompletionString completion_string,
CXCursorKind *kind) { … }
CXString
clang_getCompletionBriefComment(CXCompletionString completion_string) { … }
namespace {
struct AllocatedCXCodeCompleteResults : public CXCodeCompleteResults { … };
}
unsigned clang_getCompletionNumFixIts(CXCodeCompleteResults *results,
unsigned completion_index) { … }
CXString clang_getCompletionFixIt(CXCodeCompleteResults *results,
unsigned completion_index,
unsigned fixit_index,
CXSourceRange *replacement_range) { … }
static std::atomic<unsigned> CodeCompletionResultObjects;
AllocatedCXCodeCompleteResults::AllocatedCXCodeCompleteResults(
IntrusiveRefCntPtr<FileManager> FileMgr)
: … { … }
AllocatedCXCodeCompleteResults::~AllocatedCXCodeCompleteResults() { … }
static unsigned long long getContextsForContextKind(
enum CodeCompletionContext::Kind kind,
Sema &S) { … }
namespace {
class CaptureCompletionResults : public CodeCompleteConsumer { … };
}
static CXCodeCompleteResults *
clang_codeCompleteAt_Impl(CXTranslationUnit TU, const char *complete_filename,
unsigned complete_line, unsigned complete_column,
ArrayRef<CXUnsavedFile> unsaved_files,
unsigned options) { … }
CXCodeCompleteResults *clang_codeCompleteAt(CXTranslationUnit TU,
const char *complete_filename,
unsigned complete_line,
unsigned complete_column,
struct CXUnsavedFile *unsaved_files,
unsigned num_unsaved_files,
unsigned options) { … }
unsigned clang_defaultCodeCompleteOptions(void) { … }
void clang_disposeCodeCompleteResults(CXCodeCompleteResults *ResultsIn) { … }
unsigned
clang_codeCompleteGetNumDiagnostics(CXCodeCompleteResults *ResultsIn) { … }
CXDiagnostic
clang_codeCompleteGetDiagnostic(CXCodeCompleteResults *ResultsIn,
unsigned Index) { … }
unsigned long long
clang_codeCompleteGetContexts(CXCodeCompleteResults *ResultsIn) { … }
enum CXCursorKind clang_codeCompleteGetContainerKind(
CXCodeCompleteResults *ResultsIn,
unsigned *IsIncomplete) { … }
CXString clang_codeCompleteGetContainerUSR(CXCodeCompleteResults *ResultsIn) { … }
CXString clang_codeCompleteGetObjCSelector(CXCodeCompleteResults *ResultsIn) { … }
static void AppendToString(StringRef &Old, StringRef New,
SmallString<256> &Buffer) { … }
static StringRef GetTypedName(CodeCompletionString *String,
SmallString<256> &Buffer) { … }
namespace {
struct OrderCompletionResults { … };
}
void clang_sortCodeCompletionResults(CXCompletionResult *Results,
unsigned NumResults) { … }