diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-01-10 18:54:52 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-01-10 18:54:52 +0000 |
commit | c6f5c6a58d34833d1fe458a518d5f59462926c7b (patch) | |
tree | 4d0ff3cd0e3a1a64017e966b5e127548633bdc60 /tools/libclang/Indexing.cpp | |
parent | 30f3b450c63a99ff5eef24b45cd999f8c2cf9b91 (diff) |
[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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172089 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/libclang/Indexing.cpp')
-rw-r--r-- | tools/libclang/Indexing.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/libclang/Indexing.cpp b/tools/libclang/Indexing.cpp index e3c2470036..53a16ae703 100644 --- a/tools/libclang/Indexing.cpp +++ b/tools/libclang/Indexing.cpp @@ -14,6 +14,7 @@ #include "CXSourceLocation.h" #include "CXString.h" #include "CXTranslationUnit.h" +#include "CLog.h" #include "clang/AST/ASTConsumer.h" #include "clang/AST/DeclVisitor.h" #include "clang/Frontend/ASTUnit.h" @@ -968,6 +969,11 @@ int clang_indexSourceFile(CXIndexAction idxAction, unsigned num_unsaved_files, CXTranslationUnit *out_TU, unsigned TU_options) { + LOG_FUNC_SECTION { + *Log << source_filename << ": "; + for (int i = 0; i != num_command_line_args; ++i) + *Log << command_line_args[i] << " "; + } IndexSourceFileInfo ITUI = { idxAction, client_data, index_callbacks, index_callbacks_size, index_options, @@ -1018,6 +1024,9 @@ int clang_indexTranslationUnit(CXIndexAction idxAction, unsigned index_callbacks_size, unsigned index_options, CXTranslationUnit TU) { + LOG_FUNC_SECTION { + *Log << TU; + } IndexTranslationUnitInfo ITUI = { idxAction, client_data, index_callbacks, index_callbacks_size, index_options, TU, |