ObjectiveC Generics: follow-up commit to r281355.
authorManman Ren <manman.ren@gmail.com>
Tue, 13 Sep 2016 21:57:28 +0000 (21:57 +0000)
committerManman Ren <manman.ren@gmail.com>
Tue, 13 Sep 2016 21:57:28 +0000 (21:57 +0000)
Correct getExtraLocalDataSize for ObjCTypeParamTypeLoc.

rdar://24619481
rdar://25060179

llvm-svn: 281404

clang/include/clang/AST/TypeLoc.h

index 5d7770d..d3db024 100644 (file)
@@ -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<SourceLocation>();