summaryrefslogtreecommitdiff
path: root/src/plugins/clangcodemodel/clangcompletion.cpp
diff options
context:
space:
mode:
authorOrgad Shaneh <orgad.shaneh@audiocodes.com>2015-02-26 08:42:05 +0200
committerOrgad Shaneh <orgads@gmail.com>2015-02-27 15:11:02 +0000
commit1a37605f919a761892cb4c4759265956e0efa453 (patch)
tree2e2868c1f096ea2c256be475b68fb8970d646cfb /src/plugins/clangcodemodel/clangcompletion.cpp
parent2ffe50c208cd62db81ec0f0bb3354158ad4d2268 (diff)
downloadqt-creator-1a37605f919a761892cb4c4759265956e0efa453.tar.gz
CppTools: Move languageFeatures around in CompletionAssist...
... from InternalCppCompletionAssistProcessor to CppCompletionAssistInterface Change-Id: I769fd86a387f1087f37b56fe114bdf132f1b0be7 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
Diffstat (limited to 'src/plugins/clangcodemodel/clangcompletion.cpp')
-rw-r--r--src/plugins/clangcodemodel/clangcompletion.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/plugins/clangcodemodel/clangcompletion.cpp b/src/plugins/clangcodemodel/clangcompletion.cpp
index 7d0e53b3ce..797d4acc1b 100644
--- a/src/plugins/clangcodemodel/clangcompletion.cpp
+++ b/src/plugins/clangcodemodel/clangcompletion.cpp
@@ -200,15 +200,14 @@ IAssistProcessor *ClangCompletionAssistProvider::createProcessor() const
}
AssistInterface *ClangCompletionAssistProvider::createAssistInterface(
- const QString &filePath,
- QTextDocument *document, bool isObjCEnabled, int position, AssistReason reason) const
+ const QString &filePath, QTextDocument *document,
+ const LanguageFeatures &languageFeatures, int position, AssistReason reason) const
{
- Q_UNUSED(isObjCEnabled);
-
CppModelManager *modelManager = CppModelManager::instance();
QList<ProjectPart::Ptr> parts = modelManager->projectPart(filePath);
if (parts.isEmpty())
parts += modelManager->fallbackProjectPart();
+ LanguageFeatures features = languageFeatures;
ProjectPart::HeaderPaths headerPaths;
QStringList options;
PchInfo::Ptr pchInfo;
@@ -220,13 +219,14 @@ AssistInterface *ClangCompletionAssistProvider::createAssistInterface(
if (!pchInfo.isNull())
options.append(Utils::createPCHInclusionOptions(pchInfo->fileName()));
headerPaths = part->headerPaths;
+ features = part->languageFeatures;
break;
}
return new ClangCompletionAssistInterface(
m_clangCompletionWrapper,
document, position, filePath, reason,
- options, headerPaths, pchInfo);
+ options, headerPaths, pchInfo, features);
}
// ------------------------
@@ -545,12 +545,14 @@ ClangCompletionAssistInterface::ClangCompletionAssistInterface(ClangCompleter::P
AssistReason reason,
const QStringList &options,
const QList<ProjectPart::HeaderPath> &headerPaths,
- const PchInfo::Ptr &pchInfo)
+ const PchInfo::Ptr &pchInfo,
+ const LanguageFeatures &features)
: AssistInterface(document, position, fileName, reason)
, m_clangWrapper(clangWrapper)
, m_options(options)
, m_headerPaths(headerPaths)
, m_savedPchPointer(pchInfo)
+ , m_languageFeatures(features)
{
Q_ASSERT(!clangWrapper.isNull());
@@ -711,10 +713,7 @@ int ClangCompletionAssistProcessor::startOfOperator(int pos,
}
SimpleLexer tokenize;
- LanguageFeatures lf = tokenize.languageFeatures();
- lf.qtMocRunEnabled = true;
- lf.objCEnabled = true;
- tokenize.setLanguageFeatures(lf);
+ tokenize.setLanguageFeatures(m_interface->languageFeatures());
tokenize.setSkipComments(false);
const Tokens &tokens = tokenize(tc.block().text(), BackwardsScanner::previousBlockState(tc.block()));
const int tokenIdx = SimpleLexer::tokenBefore(tokens, qMax(0, tc.positionInBlock() - 1)); // get the token at the left of the cursor