[libclang] Enhance logging capabilities of libclang.

-provide a "raw_ostream'ish" class to make it convenient to output logging info.
-use macros to automate a bit the logging functionality inside libclang functions
-when logging, print a stack trace if "LIBCLANG_LOGGING=2" environment is set.
-add logging to more functions.

llvm-svn: 172089
This commit is contained in:
Argyrios Kyrtzidis
2013-01-10 18:54:52 +00:00
parent d12618f6db
commit ea47435861
5 changed files with 176 additions and 37 deletions

View File

@@ -17,6 +17,7 @@
#include "CXCursor.h"
#include "CXString.h"
#include "CXTranslationUnit.h"
#include "CLog.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/Type.h"
@@ -48,6 +49,7 @@
using namespace clang;
using namespace clang::cxstring;
using namespace clang::cxindex;
extern "C" {
@@ -821,6 +823,11 @@ CXCodeCompleteResults *clang_codeCompleteAt(CXTranslationUnit TU,
struct CXUnsavedFile *unsaved_files,
unsigned num_unsaved_files,
unsigned options) {
LOG_FUNC_SECTION {
*Log << TU << ' '
<< complete_filename << ':' << complete_line << ':' << complete_column;
}
CodeCompleteAtInfo CCAI = { TU, complete_filename, complete_line,
complete_column, unsaved_files, num_unsaved_files,
options, 0 };