@@ -3270,26 +3270,12 @@ namespace {
3270
3270
3271
3271
Decl *VisitClassTemplateSpecializationDecl (
3272
3272
const clang::ClassTemplateSpecializationDecl *decl) {
3273
- bool isPair = decl->getSpecializedTemplate ()->isInStdNamespace () &&
3274
- decl->getSpecializedTemplate ()->getName () == " pair" ;
3275
-
3276
- // Before we go any further, check if we've already got tens of thousands
3277
- // of specializations. If so, it means we're likely instantiating a very
3278
- // deep/complex template, or we've run into an infinite loop. In either
3279
- // case, its not worth the compile time, so bail.
3280
- // TODO: this could be configurable at some point.
3281
- size_t specializationLimit = !isPair ? 1000 : 10000 ;
3282
- if (size_t (
3283
- llvm::size (decl->getSpecializedTemplate ()->specializations ())) >
3284
- specializationLimit) {
3285
- // Note: it would be nice to import a dummy unavailable struct,
3286
- // but we would then need to instantiate the template here,
3287
- // as we cannot import a struct without a definition. That would
3288
- // defeat the purpose. Also, we can't make the dummy
3289
- // struct simply unavailable, as that still makes the
3290
- // typelias that references it available.
3273
+ // Importing std::conditional substantially increases compile times when
3274
+ // building with libstdc++, i.e. on most Linux distros.
3275
+ if (decl->isInStdNamespace () && decl->getIdentifier () &&
3276
+ (decl->getName () == " conditional" || decl->getName () == " __or_" ||
3277
+ decl->getName () == " _Expr" ))
3291
3278
return nullptr ;
3292
- }
3293
3279
3294
3280
// `decl->getDefinition()` can return nullptr before the call to sema and
3295
3281
// return its definition afterwards.
0 commit comments