Commit b3113bbb authored by Marco Bubke's avatar Marco Bubke
Browse files

Clang: Reparse always before you complete the code



There are two ways to hot fix the dependency problem. First version is to
disable the caching(not the preamble) but it is triggering bugs. Second 
version is to enable caching and reparse before every complete. I opted
for the second version because it is the commonly used path for most
implementations. Later we have to minimize the reparse calls but for that 
we need the cooperation of editor.

Change-Id: I878afb896cbf2338cbeb13d9e596a7776dd49854
Reviewed-by: default avatarNikolai Kosjar <nikolai.kosjar@theqtcompany.com>
parent 568d7e7c
......@@ -49,6 +49,8 @@ CodeCompleter::CodeCompleter(TranslationUnit translationUnit)
QVector<CodeCompletion> CodeCompleter::complete(uint line, uint column)
{
translationUnit.reparse();
ClangCodeCompleteResults completeResults(clang_codeCompleteAt(translationUnit.cxTranslationUnit(),
translationUnit.filePath().constData(),
line,
......
......@@ -96,6 +96,13 @@ void TranslationUnit::reset()
d.reset();
}
void TranslationUnit::reparse()
{
cxTranslationUnit();
reparseTranslationUnit();
}
CXIndex TranslationUnit::index() const
{
checkIfNull();
......
......@@ -73,6 +73,7 @@ public:
bool isNull() const;
void reset();
void reparse();
CXIndex index() const;
CXTranslationUnit cxTranslationUnit() const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment