Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions lib/library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1385,6 +1385,27 @@ const Library::Container* Library::detectContainerInternal(const Token* const ty
{
if (!typeStart)
return nullptr;
if (typeStart->tokType() != Token::Type::eType && typeStart->tokType() != Token::Type::eName) {
return nullptr;
}
// bail out on function declarations (without implementation)
if (typeStart->tokType() == Token::Type::eName &&
typeStart->previous() &&
(typeStart->previous()->tokType() == Token::Type::eType || // return type
typeStart->previous()->tokType() == Token::Type::eArithmeticalOp || // *
typeStart->previous()->tokType() == Token::Type::eOther || // ::
typeStart->previous()->tokType() == Token::Type::eName // qualified return type
)) {
return nullptr;
}
// TODO: bail out on standard types
// TODO: stringFromTokenRange in Token::expressionString()
// TODO: update_property_info in Token::str()
if (typeStart->str() == "stringFromTokenRange")
{
int i;
}
std::cout << typeStart->str() << std::endl;
const Token* firstLinkedTok = nullptr;
for (const Token* tok = typeStart; tok && !tok->varId(); tok = tok->next()) {
if (!tok->link())
Expand Down Expand Up @@ -1952,6 +1973,11 @@ const Library::SmartPointer* Library::detectSmartPointer(const Token* tok, bool
{
if (!tok)
return nullptr;
if (tok->tokType() != Token::Type::eType && tok->tokType() != Token::Type::eName) {
return nullptr;
}

// TODO: this is flawed and might result in lookups like "uint64_tflags_"
std::string typestr = withoutStd ? "std::" : "";
if (tok->str() == "::")
tok = tok->next();
Expand Down