fixes #11104 (avoid C++-only parsing when processing C code in parsedecl()) / also avoid remaining Library::detect*() calls#5346
Conversation
…case it was already retrieving it from the underlying `TokenList`
Library::detect*() calls
| } | ||
| } | ||
| if (tok->astParent() && Token::Match(tok->astOperand1(), "%name%|::")) { | ||
| if (tok->astParent() && tok->astOperand1() && tok->astOperand1()->isCpp() && Token::Match(tok->astOperand1(), "%name%|::")) { |
There was a problem hiding this comment.
Is it possible to use tok->astParent()->isCpp()?
There was a problem hiding this comment.
It could just be tok->isCpp() as it is global for all tokens from the same list.
I chose that since it was the underlying token we work from for the detection.
There was a problem hiding this comment.
I will adjust that. I missed some unnecessary calls.
There was a problem hiding this comment.
Done. There was an even cleaner solution.
54fc616 to
3f7faef
Compare
|
With all the underlying improvements to the culprit the impact has severely lessened (at least for this project) but here's some numbers scanning Clang 15 |
|
Okay so |
3f7faef to
931d033
Compare
Sorry, I don't follow. Different PR? |
No, I made the whole following block with flags in if (mTypeStartToken) {
std::string strtype = mTypeStartToken->str();
for (const Token *typeToken = mTypeStartToken; Token::Match(typeToken, "%type% :: %type%"); typeToken = typeToken->tokAt(2))
strtype += "::" + typeToken->strAt(2);
setFlag(fIsClass, !lib->podtype(strtype) && !mTypeStartToken->isStandardType() && !isEnumType() && !isPointer() && !isReference() && strtype != "...");
setFlag(fIsStlType, Token::simpleMatch(mTypeStartToken, "std ::"));
setFlag(fIsStlString, ::isStlStringType(mTypeStartToken));
setFlag(fIsSmartPointer, lib->isSmartPointer(mTypeStartToken));
} |
No description provided.