As blockchain name suggests, it's a chain of blocks.
So if your selfish miner works on its own private chain, you don't have to accept blocks from the main chain.
AcceptBlock function and other functions which are related to accepting blocks are located in validation.cpp