Improve implementation of ctags.

This commit is contained in:
Vassil Vassilev 2014-06-04 09:13:35 +02:00 committed by sftnight
parent 6d1d81309d
commit cd3259b39a
5 changed files with 18 additions and 15 deletions

View File

@ -11,6 +11,7 @@ CLINGDIR := $(MODDIR)
##### libCling ##### ##### libCling #####
CLINGS := $(wildcard $(MODDIR)/lib/Interpreter/*.cpp) \ CLINGS := $(wildcard $(MODDIR)/lib/Interpreter/*.cpp) \
$(wildcard $(MODDIR)/lib/MetaProcessor/*.cpp) \ $(wildcard $(MODDIR)/lib/MetaProcessor/*.cpp) \
$(wildcard $(MODDIR)/lib/TagsExtension/*.cpp) \
$(wildcard $(MODDIR)/lib/Utils/*.cpp) $(wildcard $(MODDIR)/lib/Utils/*.cpp)
CLINGO := $(call stripsrc,$(CLINGS:.cpp=.o)) CLINGO := $(call stripsrc,$(CLINGS:.cpp=.o))
CLINGEXCEPO := $(call stripsrc,$(MODDIR)/lib/Interpreter/RuntimeException.o) CLINGEXCEPO := $(call stripsrc,$(MODDIR)/lib/Interpreter/RuntimeException.o)

View File

@ -1,6 +1,6 @@
#include "Wrapper.h" #include "Wrapper.h"
#include "readtags.h"
namespace cling { namespace cling {
struct TagFileInternals;
///\brief Implements tag operations for Ctags ///\brief Implements tag operations for Ctags
class CtagsFileWrapper : public TagFileWrapper { class CtagsFileWrapper : public TagFileWrapper {
public: public:
@ -22,12 +22,7 @@ namespace cling {
void read(); void read();
struct TagFileInternals{ TagFileInternals* m_Tagfile;
tagFile* tf;
tagFileInfo tfi;
};
TagFileInternals m_Tagfile;
std::string m_Tagfilename; std::string m_Tagfilename;
std::string m_Tagpath; std::string m_Tagpath;
bool m_Generated; bool m_Generated;

View File

@ -16,7 +16,7 @@
#include "cling/Interpreter/Transaction.h" #include "cling/Interpreter/Transaction.h"
#include "cling/Interpreter/Value.h" #include "cling/Interpreter/Value.h"
#include "cling/MetaProcessor/MetaProcessor.h" #include "cling/MetaProcessor/MetaProcessor.h"
#include "cling/TagsExtension/Callback.h" #include "cling/TagsExtension/AutoloadCallback.h"
#include "../lib/Interpreter/IncrementalParser.h" #include "../lib/Interpreter/IncrementalParser.h"

View File

@ -1,4 +1,4 @@
#include "cling/TagsExtension/Callback.h" #include "cling/TagsExtension/AutoloadCallback.h"
#include "clang/Basic/Diagnostic.h" #include "clang/Basic/Diagnostic.h"
#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/SmallVector.h"
#include "clang/Sema/Sema.h" #include "clang/Sema/Sema.h"

View File

@ -1,6 +1,8 @@
#include "FSUtils.h" #include "FSUtils.h"
#include "readtags.h"
#include "cling/TagsExtension/CtagsWrapper.h" #include "cling/TagsExtension/CtagsWrapper.h"
#include "llvm/ADT/StringRef.h" #include "llvm/ADT/StringRef.h"
@ -8,8 +10,13 @@
#include "llvm/Support/raw_ostream.h" #include "llvm/Support/raw_ostream.h"
namespace cling { namespace cling {
struct TagFileInternals{
tagFile* tf;
tagFileInfo tfi;
};
CtagsFileWrapper::CtagsFileWrapper(std::string path, bool recurse, bool fileP) CtagsFileWrapper::CtagsFileWrapper(std::string path, bool recurse, bool fileP)
:TagFileWrapper(path) { :TagFileWrapper(path), m_Tagfile(new TagFileInternals()) {
// llvm::errs()<<path<<'\n'; // llvm::errs()<<path<<'\n';
// m_Tagfile = new TagFileInternals(); // m_Tagfile = new TagFileInternals();
if (fileP) { if (fileP) {
@ -56,14 +63,14 @@ namespace cling {
tagEntry entry; tagEntry entry;
int options = TAG_OBSERVECASE | (partialMatch?TAG_PARTIALMATCH:TAG_FULLMATCH); int options = TAG_OBSERVECASE | (partialMatch?TAG_PARTIALMATCH:TAG_FULLMATCH);
tagResult result = tagsFind(m_Tagfile.tf, &entry, name.c_str(), options); tagResult result = tagsFind(m_Tagfile->tf, &entry, name.c_str(), options);
while (result==TagSuccess){ while (result==TagSuccess){
LookupResult r; LookupResult r;
r.name = entry.name; r.name = entry.name;
r.kind = entry.kind; r.kind = entry.kind;
map[entry.file] = r; map[entry.file] = r;
result=tagsFindNext(m_Tagfile.tf, &entry); result=tagsFindNext(m_Tagfile->tf, &entry);
} }
return map; return map;
@ -114,11 +121,11 @@ namespace cling {
} }
void CtagsFileWrapper::read() { void CtagsFileWrapper::read() {
m_Tagfile.tf m_Tagfile->tf
= tagsOpen((m_Tagpath + m_Tagfilename).c_str(), &(m_Tagfile.tfi)); = tagsOpen((m_Tagpath + m_Tagfilename).c_str(), &(m_Tagfile->tfi));
//std::cout<<"File "<<tagpath+tagfilename<<" read.\n"; //std::cout<<"File "<<tagpath+tagfilename<<" read.\n";
if (m_Tagfile.tfi.status.opened == false) if (m_Tagfile->tfi.status.opened == false)
m_Validfile = false; m_Validfile = false;
else else
m_Validfile = true; m_Validfile = true;