diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2017-02-26 05:37:56 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2017-02-26 05:37:56 +0000 |
commit | 6d1a15b2d402e0d768b285fc9a136ff36be3db1c (patch) | |
tree | f223f8ad0f4edc30b0e38bef5a5dec69990e5aac /clang/tools/c-index-test/core_main.cpp | |
parent | 42ef2177af937a2eb5a837297373dfa60c700770 (diff) | |
download | bcm5719-llvm-6d1a15b2d402e0d768b285fc9a136ff36be3db1c.tar.gz bcm5719-llvm-6d1a15b2d402e0d768b285fc9a136ff36be3db1c.zip |
[index] Add 'Parameter' symbol kind and 'Local' symbol property to distinguish function-local symbols
Parameters have a 'child' relation to their function/method.
Also add an option '-include-locals' to 'c-index-test core' to enable indexing of function-local symbols.
Original patch from Nathan Hawes with some changes by me.
https://reviews.llvm.org/D30304
llvm-svn: 296282
Diffstat (limited to 'clang/tools/c-index-test/core_main.cpp')
-rw-r--r-- | clang/tools/c-index-test/core_main.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/clang/tools/c-index-test/core_main.cpp b/clang/tools/c-index-test/core_main.cpp index f371870117d..4f2c3cb34a9 100644 --- a/clang/tools/c-index-test/core_main.cpp +++ b/clang/tools/c-index-test/core_main.cpp @@ -55,6 +55,9 @@ static cl::opt<bool> DumpModuleImports("dump-imported-module-files", cl::desc("Print symbols and input files from imported modules")); +static cl::opt<bool> +IncludeLocals("include-locals", cl::desc("Print local symbols")); + static cl::opt<std::string> ModuleFilePath("module-file", cl::desc("Path to module file to print symbols from")); @@ -159,7 +162,8 @@ static void dumpModuleFileInputs(serialization::ModuleFile &Mod, } static bool printSourceSymbols(ArrayRef<const char *> Args, - bool dumpModuleImports) { + bool dumpModuleImports, + bool indexLocals) { SmallVector<const char *, 4> ArgsWithProgName; ArgsWithProgName.push_back("clang"); ArgsWithProgName.append(Args.begin(), Args.end()); @@ -172,6 +176,7 @@ static bool printSourceSymbols(ArrayRef<const char *> Args, raw_ostream &OS = outs(); auto DataConsumer = std::make_shared<PrintIndexDataConsumer>(OS); IndexingOptions IndexOpts; + IndexOpts.IndexFunctionLocals = indexLocals; std::unique_ptr<FrontendAction> IndexAction; IndexAction = createIndexingAction(DataConsumer, IndexOpts, /*WrappedAction=*/nullptr); @@ -297,7 +302,7 @@ int indextest_core_main(int argc, const char **argv) { errs() << "error: missing compiler args; pass '-- <compiler arguments>'\n"; return 1; } - return printSourceSymbols(CompArgs, options::DumpModuleImports); + return printSourceSymbols(CompArgs, options::DumpModuleImports, options::IncludeLocals); } return 0; |