Beispiel #1
0
static void
MarkLeaf(Node *leaf, MarkContext *context)
{
    cpBBTree *tree = context->tree;
    if(leaf->STAMP == GetStamp(tree)){
        Node *staticRoot = context->staticRoot;
        if(staticRoot) MarkLeafQuery(staticRoot, leaf, cpFalse, context);
        
        for(Node *node = leaf; node->parent; node = node->parent){
            if(node == node->parent->A){
                MarkLeafQuery(node->parent->B, leaf, cpTrue, context);
            } else {
                MarkLeafQuery(node->parent->A, leaf, cpFalse, context);
            }
        }
    } else {
        Pair *pair = leaf->PAIRS;
        while(pair){
            if(leaf == pair->b.leaf){
                context->func(pair->a.leaf->obj, leaf->obj, context->data);
                pair = pair->b.next;
            } else {
                pair = pair->a.next;
            }
        }
    }
}
Beispiel #2
0
static void
cpBBTreeInsert(cpBBTree *tree, void *obj, cpHashValue hashid)
{
    Node *leaf = (Node *)cpHashSetInsert(tree->leaves, hashid, obj, tree, (cpHashSetTransFunc)leafSetTrans);
    
    Node *root = tree->root;
    tree->root = SubtreeInsert(root, leaf, tree);
    
    leaf->STAMP = GetStamp(tree);
    LeafAddPairs(leaf, tree);
    IncrementStamp(tree);
}
Beispiel #3
0
// DoPreLinkCleanup
//------------------------------------------------------------------------------
void LinkerNode::DoPreLinkCleanup() const
{
    // only for Microsoft compilers
    if ( GetFlag( LINK_FLAG_MSVC ) == false )
    {
        return;
    }

    bool deleteFiles = false;
    if ( GetFlag( LINK_FLAG_INCREMENTAL ) )
    {
        if ( FBuild::Get().GetOptions().m_ForceCleanBuild )
        {
            deleteFiles = true; // force a full re-link
        }
    }
    else
    {
        // cleanup old ILK files and force PDB to be rebuilt
        // (old PDBs get large and dramatically slow link times)
        deleteFiles = true;
    }

    // Work around for VS2013/2015 bug where /showincludes doesn't work if cl.exe
    // thinks it can skip compilation (it outputs "Note: reusing persistent precompiled header %s")
    // If FASTBuild is building because we've not built before, then cleanup old files
    // to ensure VS2013/2015 /showincludes will work
    if ( GetStamp() == 0 )
    {
        deleteFiles = true;
    }

    if ( deleteFiles )
    {
        // output file
        FileIO::FileDelete( GetName().Get() );

        // .ilk
        const char * lastDot = GetName().FindLast( '.' );
        AStackString<> ilkName( GetName().Get(), lastDot ? lastDot : GetName().GetEnd() );
        ilkName += ".ilk";
        FileIO::FileDelete( ilkName.Get() );

        // .pdb - TODO: Handle manually specified /PDB
        AStackString<> pdbName( GetName().Get(), lastDot ? lastDot : GetName().GetEnd() );
        pdbName += ".pdb";
        FileIO::FileDelete( pdbName.Get() );
    }
}
Beispiel #4
0
static cpBool
LeafUpdate(Node *leaf, cpBBTree *tree)
{
    Node *root = tree->root;
    cpBB bb = tree->spatialIndex.bbfunc(leaf->obj);
    
    if(!cpBBContainsBB(leaf->bb, bb)){
        leaf->bb = GetBB(tree, leaf->obj);
        
        root = SubtreeRemove(root, leaf, tree);
        tree->root = SubtreeInsert(root, leaf, tree);
        
        PairsClear(leaf, tree);
        leaf->STAMP = GetStamp(tree);
        
        return cpTrue;
    }
    
    return cpFalse;
}