[llvm-bugs] [Bug 31304] New: Wrongly detected Called C++ object pointer is null for QModelIndex

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Dec 7 00:17:12 PST 2016


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: kremenek at apple.com
          Reporter: xiangzhai83 at gmail.com
                CC: llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20161207/cf55bf01/attachment.html>


More information about the llvm-bugs mailing list