Given that these lines are almost identical to the above lines: could you extract them into a separate function, one that takes the EnumDecl* and a bool isGlobal?