yaxunl added a comment. I did profiling with valgrind for the cost of checking disabled types and declarations. For a typical program, time spent in checking disabled types and declarations are less than 0.1%, so this cost can be ignored. https://reviews.llvm.org/D21698