https://llvm.org/bugs/show_bug.cgi?id=31304

            Bug ID: 31304
           Summary: Wrongly detected Called C++ object pointer is null for
                    QModelIndex
           Product: clang
           Version: 3.9
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: kreme...@apple.com
          Reporter: xiangzha...@gmail.com
                CC: llvm-bugs@lists.llvm.org
    Classification: Unclassified

Hi llvm developers,

Clang Static Analyzer consider: 

QModelIndex firstColIndex = index.model()->index(index.row(), 0,
index.parent());
might Called C++ object pointer is null

*BUT* let's see the code about line 14:

Node* Node::createNodeForOriginalIndex( const QModelIndex& index )             
    {                                                                           
        if ( !index.isValid() && isPlace() ) {                                  
            return this;                                                        
        }                                                                       

        Q_ASSERT( index.isValid() );                                            

        // all the node mapping is done on the first col, so make sure we use   
        // an index on the first col                                            
        //                                                                      
        // A valid index belongs to a model, and has non-negative row and
column numbers
        // so index.model() is NOT nullptr if index.isValid()                   
---> QModelIndex firstColIndex = index.model()->index(index.row(), 0,
index.parent());
        Node* node = findNodeForOriginalIndex( firstColIndex );                 
        if ( !node ) {                                                          
            Node* parentNode = createNodeForOriginalIndex(
firstColIndex.parent() );
            node = parentNode->getChildNode( firstColIndex );                   
        }                                                                       

        return node;                                                            
    }

It might be a wrong detect!

Regards,
Leslie Zhai

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to