diff --git a/lib/importproject.cpp b/lib/importproject.cpp index 47c55e09a44..e67ac4c118b 100644 --- a/lib/importproject.cpp +++ b/lib/importproject.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -567,6 +568,22 @@ namespace { TokenList tokenlist(&s); std::istringstream istr(c); tokenlist.createTokens(istr, Standards::Language::C); // TODO: check result + // TODO: put in a helper + // generate links + { + std::stack lpar; + for (Token* tok2 = tokenlist.front(); tok2; tok2 = tok2->next()) { + if (tok2->str() == "(") + lpar.push(tok2); + else if (tok2->str() == ")") { + if (lpar.empty()) + break; + Token::createMutualLinks(lpar.top(), tok2); + lpar.pop(); + } + } + } + tokenlist.createAst(); for (const Token *tok = tokenlist.front(); tok; tok = tok->next()) { if (tok->str() == "(" && tok->astOperand1() && tok->astOperand2()) { // TODO: this is wrong - it is Contains() not Equals()