It doesn't even have to be anywhere near a gun or even fit any known gun. If it exists and is intended to quiet the noise of a gun, or is a part of any device intended only to quiet the noise of a gun, it is a firearm silencer under the law. It doesn't even have to silence the gun; if it diminishes the noise in any way, it is a silencer.
Nor does it have to be a separate device. One way to make a silencer is to drill holes in the barrel to allow gradual gas release into some kind of sleeve or wrapping. In that case, the barrel is the silencer under the law.
Some legal "experts" on these sites contend that "silencers" do not really silence the noise of the gun and so are only "suppressors" and are therefore legal. I wouldn't like to try that argument in federal court, unless I hoped to make a getaway while everyone was laughing.