symboldatabase: Remove unneeded check

scope1 cannot be null at that point of time. If it were, the program
would have crashed, before (it's dereferenced ->)
This commit doesn't just remove dead code, but eliminates a tricky bug,
possibly introduced by over-optimizing compilers:
An explanation why the compiler could produce bad code here is found at
http://blog.regehr.org/archives/970

This commit was enabled by http://css.csail.mit.edu/stack/

Signed-off-by: Stefan Beller <stefanbeller@googlemail.com>
This commit is contained in:
Stefan Beller 2013-08-20 14:06:20 +02:00
parent 4c0ba2b36a
commit e0d71de23a
1 changed files with 1 additions and 1 deletions

View File

@ -1298,7 +1298,7 @@ void SymbolDatabase::addClassFunction(Scope **scope, const Token **tok, const To
bool match = false; bool match = false;
if (scope1->className == tok1->str() && (scope1->type != Scope::eFunction)) { if (scope1->className == tok1->str() && (scope1->type != Scope::eFunction)) {
// do the scopes match (same scope) or do their names match (multiple namespaces) // do the scopes match (same scope) or do their names match (multiple namespaces)
if ((*scope == scope1->nestedIn) || (*scope && scope1 && if ((*scope == scope1->nestedIn) || (*scope) &&
(*scope)->className == scope1->nestedIn->className && (*scope)->className == scope1->nestedIn->className &&
!(*scope)->className.empty() && !(*scope)->className.empty() &&
(*scope)->type == scope1->nestedIn->type)) { (*scope)->type == scope1->nestedIn->type)) {