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 #####
CLINGS := $(wildcard $(MODDIR)/lib/Interpreter/*.cpp) \
$(wildcard $(MODDIR)/lib/MetaProcessor/*.cpp) \
$(wildcard $(MODDIR)/lib/TagsExtension/*.cpp) \
$(wildcard $(MODDIR)/lib/Utils/*.cpp)
CLINGO := $(call stripsrc,$(CLINGS:.cpp=.o))
CLINGEXCEPO := $(call stripsrc,$(MODDIR)/lib/Interpreter/RuntimeException.o)

View File

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

View File

@ -16,7 +16,7 @@
#include "cling/Interpreter/Transaction.h"
#include "cling/Interpreter/Value.h"
#include "cling/MetaProcessor/MetaProcessor.h"
#include "cling/TagsExtension/Callback.h"
#include "cling/TagsExtension/AutoloadCallback.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 "llvm/ADT/SmallVector.h"
#include "clang/Sema/Sema.h"

View File

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