diff --git a/clang/include/clang/AST/TypeLoc.h b/clang/include/clang/AST/TypeLoc.h index 5d7770d80549..d3db024bc65b 100644 --- a/clang/include/clang/AST/TypeLoc.h +++ b/clang/include/clang/AST/TypeLoc.h @@ -763,7 +763,9 @@ public: unsigned getExtraLocalDataSize() const { if (!this->getNumProtocols()) return 0; - return this->getNumProtocols() * sizeof(SourceLocation) ; + // When there are protocol qualifers, we have LAngleLoc and RAngleLoc + // as well. + return (this->getNumProtocols() + 2) * sizeof(SourceLocation) ; } unsigned getExtraLocalDataAlignment() const { return llvm::alignOf();