Review Request: Fix MakeOutput items for cmake builds with relative paths

Milian Wolff mail at milianw.de
Tue Mar 1 09:34:42 UTC 2011


Manuel Massing, 28.02.2011:
> Hi Milian,
> 
> patches attached. Let me know if you prefer this as a single squashed
> patch.

yes, I'd prefer a single patch for that as it belongs together imo.

Furthermore the wrong i18n usage still persists in the patches you send. 
Please fix that.

Also - correct me if I'm wrong - I fear your code is overly complex: Imo the 
map with the iterators is not needed, the index lookup in a QList is O(1) and 
hence you should use that for currentDirs. See also:

http://doc.qt.nokia.com/latest/containers.html#algorithmic-complexity

Your code would then be along the lines of the following:

                    if( actFormat.action == "cd" )
                    {
                        currentDirs.insert( currentDirs.end(), regEx.cap( 
actFormat.fileGroup ) );
                    }

                    // Special case for cmake: we want to parse the "Compiling 
<objectfile>" expression
                    // also for the "potential_cd" case below, so continue 
parsing
                    if ( actFormat.action == "compiling" && actFormat.tool == 
"cmake")
                    {
                        matched = true;
                        continue;
                    }
                    // This is a special action triggered whenever cmake 
compiles an object file. We use
                    // it to find out about the build paths encountered during 
a build. They are later
                    // searched by urlForFile to find source files referenced 
in compiler errors.
                    if ( actFormat.action == "potential_cd" )
                    {
                        KUrl url = buildDir;
                        url.addPath(regEx.cap( actFormat.fileGroup ));
                        QString dirName = url.toLocalFile();
                        int pos = currentDirs.indexOf(dirName);
                        // Encountered new build directory?
                        if (pos == -1)
                        {
                            QStringList::iterator pos = currentDirs.insert( 
currentDirs.end(), dirName );
                        } else {
                            // Build dir already in currentDirs, but move it 
to back of currentDirs list
                            // (this gives us most-recently-used semantics in 
urlForFile)
                            currentDirs.append(currentDirs.takeAt(pos));
                        }
                    }
-- 
Milian Wolff
mail at milianw.de
http://milianw.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20110301/bed3dedb/attachment.sig>


More information about the KDevelop-devel mailing list