[PATCH] D52268: [AST] Squeeze some bits in LinkageComputer

George Burgess IV via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 19 15:47:21 PDT 2018


george.burgess.iv added a comment.

Thanks for this! LGTM after erichkeane's comments are resolved.

> I did a little digging on this, and it seems to be to keep track of a declarations linkage for caching sake

Yeah, otherwise, we get exponential behavior on some pathological template-y patterns.



================
Comment at: lib/AST/Linkage.h:93
   static QueryType makeCacheKey(const NamedDecl *ND, LVComputationKind Kind) {
-    return std::make_pair(ND, Kind.toBits());
+    return QueryType(ND, Kind.toBits());
   }
----------------
(FWIW, it looks like `PointerIntPairInfo::UpdateInt` asserts that `Kind.toBits()` fits nicely in `NumLVComputationKindBits`. So if anything gets added, it'll yell and we can just revert to the current way of doing this :) )


Repository:
  rC Clang

https://reviews.llvm.org/D52268





More information about the cfe-commits mailing list