<div dir="ltr">Thanks for the quick fix. ASAN is happy now.<div><br></div><div>--Artem</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 13, 2016 at 3:09 PM, Manman <span dir="ltr"><<a href="mailto:mren@apple.com" target="_blank">mren@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">I checked in r281404. Hopefully it will fix the issue.<div><br></div><div>Let me know if it does not.</div><div><br></div><div>Thanks,</div><div>Manman</div><div><div class="h5"><div><br><div><blockquote type="cite"><div>On Sep 13, 2016, at 3:03 PM, Artem Belevich via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>> wrote:</div><br class="m_4891632917363646653Apple-interchange-newline"><div><div dir="ltr">Manman,<div><br></div><div>FYI, It appears that some of your ObjC commits today trigger asan error.</div><div>Sanitizer bots are broken by PR30341, so they don't report the issue yet.</div><div><br></div><div>--Artem</div><div><br></div><div><div>$ llvm/tools/clang/clang -cc1 -internal-isystem llvm/tools/clang/staging/<wbr>include -nostdsysteminc -fblocks -fsyntax-only -Wnullable-to-nonnull-<wbr>conversion llvm/tools/clang/test/<wbr>SemaObjC/parameterized_<wbr>classes_subst.m -verify</div><div>==============================<wbr>==============================<wbr>=====</div><div>==223101==ERROR: AddressSanitizer: use-after-poison on address 0x621000091288 at pc 0x000001a02b3f bp 0x7fffff2996f0 sp 0x7fffff2996e8</div><div>WRITE of size 4 at 0x621000091288 thread T0</div><div> #0 0x1a02b3e in clang::ObjCTypeParamTypeLoc::<wbr>setProtocolRAngleLoc(clang::<wbr>SourceLocation) third_party/llvm/llvm/tools/<wbr>clang/include/clang/AST/<wbr>TypeLoc.h:737:55</div><div> #1 0x213f86b in clang::Sema::<wbr>actOnObjCTypeArgsAndProtocolQu<wbr>alifiers(clang::Scope*, clang::SourceLocation, clang::OpaquePtr<clang::<wbr>QualType>, clang::SourceLocation, llvm::ArrayRef<clang::<wbr>OpaquePtr<clang::QualType> >, clang::SourceLocation, clang::SourceLocation, llvm::ArrayRef<clang::Decl*>, llvm::ArrayRef<clang::<wbr>SourceLocation>, clang::SourceLocation) third_party/llvm/llvm/tools/<wbr>clang/lib/Sema/SemaType.cpp:<wbr>1165:13</div><div> #2 0x2060347 in clang::Parser::<wbr>parseObjCTypeArgsAndProtocolQu<wbr>alifiers(clang::<wbr>SourceLocation, clang::OpaquePtr<clang::<wbr>QualType>, bool, clang::SourceLocation&) third_party/llvm/llvm/tools/<wbr>clang/lib/Parse/ParseObjc.cpp:<wbr>1878:18</div><div> #3 0x1ffca6f in clang::Parser::<wbr>TryAnnotateTypeOrScopeTokenAft<wbr>erScopeSpec(bool, bool, clang::CXXScopeSpec&, bool) third_party/llvm/llvm/tools/<wbr>clang/lib/Parse/Parser.cpp:<wbr>1770:13</div><div> #4 0x1ffd4fc in clang::Parser::<wbr>TryAnnotateTypeOrScopeToken(<wbr>bool, bool) third_party/llvm/llvm/tools/<wbr>clang/lib/Parse/Parser.cpp:<wbr>1733:10</div><div> #5 0x20df910 in clang::Parser::<wbr>isTypeSpecifierQualifier() third_party/llvm/llvm/tools/<wbr>clang/lib/Parse/ParseDecl.cpp:<wbr>4381:9</div><div> #6 0x205ecf5 in clang::Parser::<wbr>ParseObjCTypeName(clang::<wbr>ObjCDeclSpec&, clang::Declarator::TheContext, clang::ParsedAttributes*) third_party/llvm/llvm/tools/<wbr>clang/lib/Parse/ParseObjc.cpp:<wbr>1274:7</div><div> #7 0x205c8f9 in clang::Parser::<wbr>ParseObjCMethodDecl(clang::<wbr>SourceLocation, clang::tok::TokenKind, clang::tok::ObjCKeywordKind, bool) third_party/llvm/llvm/tools/<wbr>clang/lib/Parse/ParseObjc.cpp:<wbr>1428:22</div><div> #8 0x2058e8b in clang::Parser::<wbr>ParseObjCInterfaceDeclList(<wbr>clang::tok::ObjCKeywordKind, clang::Decl*) third_party/llvm/llvm/tools/<wbr>clang/lib/Parse/ParseObjc.cpp:<wbr>633:11</div><div> #9 0x2053154 in clang::Parser::<wbr>ParseObjCAtInterfaceDeclaratio<wbr>n(clang::SourceLocation, clang::ParsedAttributes&) third_party/llvm/llvm/tools/<wbr>clang/lib/Parse/ParseObjc.cpp:<wbr>388:3</div><div> #10 0x2051fa9 in clang::Parser::<wbr>ParseObjCAtDirectives() third_party/llvm/llvm/tools/<wbr>clang/lib/Parse/ParseObjc.cpp:<wbr>63:18</div><div> #11 0x1ff7871 in clang::Parser::<wbr>ParseExternalDeclaration(<wbr>clang::Parser::<wbr>ParsedAttributesWithRange&, clang::ParsingDeclSpec*) third_party/llvm/llvm/tools/<wbr>clang/lib/Parse/Parser.cpp:<wbr>757:12</div><div> #12 0x1ff6c61 in clang::Parser::<wbr>ParseTopLevelDecl(clang::<wbr>OpaquePtr<clang::DeclGroupRef><wbr>&) third_party/llvm/llvm/tools/<wbr>clang/lib/Parse/Parser.cpp:<wbr>628:12</div><div> #13 0x1ff016d in clang::ParseAST(clang::Sema&, bool, bool) third_party/llvm/llvm/tools/<wbr>clang/lib/Parse/ParseAST.cpp:<wbr>147:18</div><div> #14 0x1ab05d3 in clang::FrontendAction::<wbr>Execute() third_party/llvm/llvm/tools/<wbr>clang/lib/Frontend/<wbr>FrontendAction.cpp:458:8</div><div> #15 0x184fbd6 in clang::CompilerInstance::<wbr>ExecuteAction(clang::<wbr>FrontendAction&) third_party/llvm/llvm/tools/<wbr>clang/lib/Frontend/<wbr>CompilerInstance.cpp:871:11</div><div> #16 0x5c6f47 in clang::<wbr>ExecuteCompilerInvocation(<wbr>clang::CompilerInstance*) third_party/llvm/llvm/tools/<wbr>clang/lib/FrontendTool/<wbr>ExecuteCompilerInvocation.cpp:<wbr>249:25</div><div> #17 0x5a114d in cc1_main(llvm::ArrayRef<char const*>, char const*, void*) third_party/llvm/llvm/tools/<wbr>clang/tools/driver/cc1_main.<wbr>cpp:183:13</div><div> #18 0x5bb3f6 in ExecuteCC1Tool(llvm::ArrayRef<<wbr>char const*>, llvm::StringRef) third_party/llvm/llvm/tools/<wbr>clang/tools/driver/driver.cpp:<wbr>299:12</div><div> #19 0x5ba314 in main third_party/llvm/llvm/tools/<wbr>clang/tools/driver/driver.cpp:<wbr>380:12</div><div><br></div><div>0x621000091288 is located 392 bytes inside of 4096-byte region [0x621000091100,<wbr>0x621000092100)</div><div>allocated by thread T0 here:</div><div> #0 0x58a52c in __interceptor_malloc third_party/llvm/llvm/<wbr>projects/compiler-rt/lib/asan/<wbr>asan_malloc_linux.cc:64:3</div><div> #1 0x5a5d0b in llvm::MallocAllocator::<wbr>Allocate(unsigned long, unsigned long) third_party/llvm/llvm/include/<wbr>llvm/Support/Allocator.h:95:12</div><div> #2 0x691b67 in llvm::BumpPtrAllocatorImpl<<wbr>llvm::MallocAllocator, 4096ul, 4096ul>::StartNewSlab() third_party/llvm/llvm/include/<wbr>llvm/Support/Allocator.h:324:<wbr>31</div><div> #3 0x6916aa in llvm::BumpPtrAllocatorImpl<<wbr>llvm::MallocAllocator, 4096ul, 4096ul>::Allocate(unsigned long, unsigned long) third_party/llvm/llvm/include/<wbr>llvm/Support/Allocator.h:249:5</div><div> #4 0x6913d1 in clang::ASTContext::Allocate(<wbr>unsigned long, unsigned int) const third_party/llvm/llvm/tools/<wbr>clang/include/clang/AST/<wbr>ASTContext.h:588:22</div><div> #5 0x3010c16 in clang::ObjCInterfaceDecl::<wbr>Create(clang::ASTContext const&, clang::DeclContext*, clang::SourceLocation, clang::IdentifierInfo*, clang::ObjCTypeParamList*, clang::ObjCInterfaceDecl*, clang::SourceLocation, bool) third_party/llvm/llvm/tools/<wbr>clang/lib/AST/DeclObjC.cpp:<wbr>1396:31</div><div> #6 0x2838c96 in clang::Sema::<wbr>ActOnStartClassInterface(<wbr>clang::Scope*, clang::SourceLocation, clang::IdentifierInfo*, clang::SourceLocation, clang::ObjCTypeParamList*, clang::IdentifierInfo*, clang::SourceLocation, llvm::ArrayRef<clang::<wbr>OpaquePtr<clang::QualType> >, clang::SourceRange, clang::Decl* const*, unsigned int, clang::SourceLocation const*, clang::SourceLocation, clang::AttributeList*) third_party/llvm/llvm/tools/<wbr>clang/lib/Sema/SemaDeclObjC.<wbr>cpp:981:7</div><div> #7 0x2053112 in clang::Parser::<wbr>ParseObjCAtInterfaceDeclaratio<wbr>n(clang::SourceLocation, clang::ParsedAttributes&) third_party/llvm/llvm/tools/<wbr>clang/lib/Parse/ParseObjc.cpp:<wbr>375:13</div><div> #8 0x2051fa9 in clang::Parser::<wbr>ParseObjCAtDirectives() third_party/llvm/llvm/tools/<wbr>clang/lib/Parse/ParseObjc.cpp:<wbr>63:18</div><div> #9 0x1ff7871 in clang::Parser::<wbr>ParseExternalDeclaration(<wbr>clang::Parser::<wbr>ParsedAttributesWithRange&, clang::ParsingDeclSpec*) third_party/llvm/llvm/tools/<wbr>clang/lib/Parse/Parser.cpp:<wbr>757:12</div><div> #10 0x1ff6c61 in clang::Parser::<wbr>ParseTopLevelDecl(clang::<wbr>OpaquePtr<clang::DeclGroupRef><wbr>&) third_party/llvm/llvm/tools/<wbr>clang/lib/Parse/Parser.cpp:<wbr>628:12</div><div> #11 0x1ff016d in clang::ParseAST(clang::Sema&, bool, bool) third_party/llvm/llvm/tools/<wbr>clang/lib/Parse/ParseAST.cpp:<wbr>147:18</div><div> #12 0x1ab05d3 in clang::FrontendAction::<wbr>Execute() third_party/llvm/llvm/tools/<wbr>clang/lib/Frontend/<wbr>FrontendAction.cpp:458:8</div><div> #13 0x184fbd6 in clang::CompilerInstance::<wbr>ExecuteAction(clang::<wbr>FrontendAction&) third_party/llvm/llvm/tools/<wbr>clang/lib/Frontend/<wbr>CompilerInstance.cpp:871:11</div><div> #14 0x5c6f47 in clang::<wbr>ExecuteCompilerInvocation(<wbr>clang::CompilerInstance*) third_party/llvm/llvm/tools/<wbr>clang/lib/FrontendTool/<wbr>ExecuteCompilerInvocation.cpp:<wbr>249:25</div><div> #15 0x5a114d in cc1_main(llvm::ArrayRef<char const*>, char const*, void*) third_party/llvm/llvm/tools/<wbr>clang/tools/driver/cc1_main.<wbr>cpp:183:13</div><div> #16 0x5bb3f6 in ExecuteCC1Tool(llvm::ArrayRef<<wbr>char const*>, llvm::StringRef) third_party/llvm/llvm/tools/<wbr>clang/tools/driver/driver.cpp:<wbr>299:12</div><div> #17 0x5ba314 in main third_party/llvm/llvm/tools/<wbr>clang/tools/driver/driver.cpp:<wbr>380:12</div><div><br></div><div>SUMMARY: AddressSanitizer: use-after-poison third_party/llvm/llvm/tools/<wbr>clang/include/clang/AST/<wbr>TypeLoc.h:737:55 in clang::ObjCTypeParamTypeLoc::<wbr>setProtocolRAngleLoc(clang::<wbr>SourceLocation)</div><div>Shadow bytes around the buggy address:</div><div> 0x0c428000a200: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa</div><div> 0x0c428000a210: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa</div><div> 0x0c428000a220: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00</div><div> 0x0c428000a230: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00</div><div> 0x0c428000a240: 00 00 00 04 00 04 00 04 00 00 00 00 00 00 00 00</div><div>=>0x0c428000a250: 00[f7]f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7</div><div> 0x0c428000a260: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7</div><div> 0x0c428000a270: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7</div><div> 0x0c428000a280: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7</div><div> 0x0c428000a290: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7</div><div> 0x0c428000a2a0: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7</div><div>Shadow byte legend (one shadow byte represents 8 application bytes):</div><div> Addressable: 00</div><div> Partially addressable: 01 02 03 04 05 06 07 </div><div> Heap left redzone: fa</div><div> Heap right redzone: fb</div><div> Freed heap region: fd</div><div> Stack left redzone: f1</div><div> Stack mid redzone: f2</div><div> Stack right redzone: f3</div><div> Stack partial redzone: f4</div><div> Stack after return: f5</div><div> Stack use after scope: f8</div><div> Global redzone: f9</div><div> Global init order: f6</div><div> Poisoned by user: f7</div><div> Container overflow: fc</div><div> Array cookie: ac</div><div> Intra object redzone: bb</div><div> ASan internal: fe</div><div> Left alloca redzone: ca</div><div> Right alloca redzone: cb</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 13, 2016 at 9:45 AM, Manman Ren via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: mren<br>
Date: Tue Sep 13 11:45:29 2016<br>
New Revision: 281351<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=281351&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject?rev=281351&view=rev</a><br>
Log:<br>
Add a class ObjCProtocolQualifiers to wrap APIs for ObjC protocol list.<br>
<br>
Now ObjCObjectType extends from ObjCProtocolQualifiers. We save number of<br>
protocols in ObjCProtocolQualifiers.<br>
<br>
This is in preparation of adding a new type class ObjCTypeParamType that<br>
can take protocol qualifiers.<br>
<br>
<a>rdar://24619481</a><br>
<a>rdar://25060179</a><br>
<br>
Differential Revision: <a href="http://reviews.llvm.org/D23078" rel="noreferrer" target="_blank">http://reviews.llvm.org/D23078</a><br>
<br>
Modified:<br>
cfe/trunk/include/clang/AST/Ty<wbr>pe.h<br>
cfe/trunk/lib/AST/Type.cpp<br>
<br>
Modified: cfe/trunk/include/clang/AST/Ty<wbr>pe.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=281351&r1=281350&r2=281351&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/cfe/trunk/include/clang/<wbr>AST/Type.h?rev=281351&r1=<wbr>281350&r2=281351&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/include/clang/AST/Ty<wbr>pe.h (original)<br>
+++ cfe/trunk/include/clang/AST/Ty<wbr>pe.h Tue Sep 13 11:45:29 2016<br>
@@ -4699,6 +4699,59 @@ public:<br>
}<br>
};<br>
<br>
+/// This class wraps the list of protocol qualifiers. For types that can<br>
+/// take ObjC protocol qualifers, they can subclass this class.<br>
+template <class T><br>
+class ObjCProtocolQualifiers {<br>
+protected:<br>
+ ObjCProtocolQualifiers() {}<br>
+ ObjCProtocolDecl * const *getProtocolStorage() const {<br>
+ return const_cast<ObjCProtocolQualifi<wbr>ers*>(this)-><wbr>getProtocolStorage();<br>
+ }<br>
+<br>
+ ObjCProtocolDecl **getProtocolStorage() {<br>
+ return static_cast<T*>(this)->getProt<wbr>ocolStorageImpl();<br>
+ }<br>
+ void setNumProtocols(unsigned N) {<br>
+ static_cast<T*>(this)->setNumP<wbr>rotocolsImpl(N);<br>
+ }<br>
+ void initialize(ArrayRef<ObjCProtoc<wbr>olDecl *> protocols) {<br>
+ setNumProtocols(protocols.size<wbr>());<br>
+ assert(getNumProtocols() == protocols.size() &&<br>
+ "bitfield overflow in protocol count");<br>
+ if (!protocols.empty())<br>
+ memcpy(getProtocolStorage(), protocols.data(),<br>
+ protocols.size() * sizeof(ObjCProtocolDecl*));<br>
+ }<br>
+<br>
+public:<br>
+ typedef ObjCProtocolDecl * const *qual_iterator;<br>
+ typedef llvm::iterator_range<qual_iter<wbr>ator> qual_range;<br>
+<br>
+ qual_range quals() const { return qual_range(qual_begin(), qual_end()); }<br>
+ qual_iterator qual_begin() const { return getProtocolStorage(); }<br>
+ qual_iterator qual_end() const { return qual_begin() + getNumProtocols(); }<br>
+<br>
+ bool qual_empty() const { return getNumProtocols() == 0; }<br>
+<br>
+ /// Return the number of qualifying protocols in this type, or 0 if<br>
+ /// there are none.<br>
+ unsigned getNumProtocols() const {<br>
+ return static_cast<const T*>(this)->getNumProtocolsImpl<wbr>();<br>
+ }<br>
+<br>
+ /// Fetch a protocol by index.<br>
+ ObjCProtocolDecl *getProtocol(unsigned I) const {<br>
+ assert(I < getNumProtocols() && "Out-of-range protocol access");<br>
+ return qual_begin()[I];<br>
+ }<br>
+<br>
+ /// Retrieve all of the protocol qualifiers.<br>
+ ArrayRef<ObjCProtocolDecl *> getProtocols() const {<br>
+ return ArrayRef<ObjCProtocolDecl *>(qual_begin(), getNumProtocols());<br>
+ }<br>
+};<br>
+<br>
/// Represents a class type in Objective C.<br>
///<br>
/// Every Objective C type is a combination of a base type, a set of<br>
@@ -4727,7 +4780,9 @@ public:<br>
/// 'id<P>' is an ObjCObjectPointerType whose pointee is an ObjCObjectType<br>
/// with base BuiltinType::ObjCIdType and protocol list [P]. Eventually<br>
/// this should get its own sugar class to better represent the source.<br>
-class ObjCObjectType : public Type {<br>
+class ObjCObjectType : public Type,<br>
+ public ObjCProtocolQualifiers<ObjCObj<wbr>ectType> {<br>
+ friend class ObjCProtocolQualifiers<ObjCObj<wbr>ectType>;<br>
// ObjCObjectType.NumTypeArgs - the number of type arguments stored<br>
// after the ObjCObjectPointerType node.<br>
// ObjCObjectType.NumProtocols - the number of protocols stored<br>
@@ -4747,16 +4802,20 @@ class ObjCObjectType : public Type {<br>
mutable llvm::PointerIntPair<const ObjCObjectType *, 1, bool><br>
CachedSuperClassType;<br>
<br>
- ObjCProtocolDecl * const *getProtocolStorage() const {<br>
- return const_cast<ObjCObjectType*>(th<wbr>is)->getProtocolStorage();<br>
- }<br>
-<br>
QualType *getTypeArgStorage();<br>
const QualType *getTypeArgStorage() const {<br>
return const_cast<ObjCObjectType *>(this)->getTypeArgStorage();<br>
}<br>
<br>
- ObjCProtocolDecl **getProtocolStorage();<br>
+ ObjCProtocolDecl **getProtocolStorageImpl();<br>
+ /// Return the number of qualifying protocols in this interface type,<br>
+ /// or 0 if there are none.<br>
+ unsigned getNumProtocolsImpl() const {<br>
+ return ObjCObjectTypeBits.NumProtocol<wbr>s;<br>
+ }<br>
+ void setNumProtocolsImpl(unsigned N) {<br>
+ ObjCObjectTypeBits.NumProtocol<wbr>s = N;<br>
+ }<br>
<br>
protected:<br>
ObjCObjectType(QualType Canonical, QualType Base,<br>
@@ -4833,30 +4892,6 @@ public:<br>
ObjCObjectTypeBits.NumTypeArg<wbr>s);<br>
}<br>
<br>
- typedef ObjCProtocolDecl * const *qual_iterator;<br>
- typedef llvm::iterator_range<qual_iter<wbr>ator> qual_range;<br>
-<br>
- qual_range quals() const { return qual_range(qual_begin(), qual_end()); }<br>
- qual_iterator qual_begin() const { return getProtocolStorage(); }<br>
- qual_iterator qual_end() const { return qual_begin() + getNumProtocols(); }<br>
-<br>
- bool qual_empty() const { return getNumProtocols() == 0; }<br>
-<br>
- /// Return the number of qualifying protocols in this interface type,<br>
- /// or 0 if there are none.<br>
- unsigned getNumProtocols() const { return ObjCObjectTypeBits.NumProtocol<wbr>s; }<br>
-<br>
- /// Fetch a protocol by index.<br>
- ObjCProtocolDecl *getProtocol(unsigned I) const {<br>
- assert(I < getNumProtocols() && "Out-of-range protocol access");<br>
- return qual_begin()[I];<br>
- }<br>
-<br>
- /// Retrieve all of the protocol qualifiers.<br>
- ArrayRef<ObjCProtocolDecl *> getProtocols() const {<br>
- return ArrayRef<ObjCProtocolDecl *>(qual_begin(), getNumProtocols());<br>
- }<br>
-<br>
/// Whether this is a "__kindof" type as written.<br>
bool isKindOfTypeAsWritten() const { return ObjCObjectTypeBits.IsKindOf; }<br>
<br>
@@ -4919,7 +4954,7 @@ inline QualType *ObjCObjectType::getType<br>
return reinterpret_cast<QualType *>(static_cast<ObjCObjectTypeI<wbr>mpl*>(this)+1);<br>
}<br>
<br>
-inline ObjCProtocolDecl **ObjCObjectType::getProtocolS<wbr>torage() {<br>
+inline ObjCProtocolDecl **ObjCObjectType::getProtocolS<wbr>torageImpl() {<br>
return reinterpret_cast<ObjCProtocolD<wbr>ecl**>(<br>
getTypeArgStorage() + ObjCObjectTypeBits.NumTypeArgs<wbr>);<br>
}<br>
<br>
Modified: cfe/trunk/lib/AST/Type.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Type.cpp?rev=281351&r1=281350&r2=281351&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/cfe/trunk/lib/AST/Type.<wbr>cpp?rev=281351&r1=281350&r2=<wbr>281351&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/AST/Type.cpp (original)<br>
+++ cfe/trunk/lib/AST/Type.cpp Tue Sep 13 11:45:29 2016<br>
@@ -546,15 +546,9 @@ ObjCObjectType::ObjCObjectType<wbr>(QualType<br>
ObjCObjectTypeBits.<wbr>NumTypeArgs = typeArgs.size();<br>
assert(getTypeArgsAsWritten()<wbr>.size() == typeArgs.size() &&<br>
"bitfield overflow in type argument count");<br>
- ObjCObjectTypeBits.NumProtocol<wbr>s = protocols.size();<br>
- assert(getNumProtocols() == protocols.size() &&<br>
- "bitfield overflow in protocol count");<br>
if (!typeArgs.empty())<br>
memcpy(getTypeArgStorage(), typeArgs.data(),<br>
typeArgs.size() * sizeof(QualType));<br>
- if (!protocols.empty())<br>
- memcpy(getProtocolStorage(), protocols.data(),<br>
- protocols.size() * sizeof(ObjCProtocolDecl*));<br>
<br>
for (auto typeArg : typeArgs) {<br>
if (typeArg->isDependentType())<br>
@@ -565,6 +559,9 @@ ObjCObjectType::ObjCObjectType<wbr>(QualType<br>
if (typeArg->containsUnexpandedPa<wbr>rameterPack())<br>
<wbr>setContainsUnexpandedParameter<wbr>Pack();<br>
}<br>
+ // Initialize the protocol qualifiers. The protocol storage is known<br>
+ // after we set number of type arguments.<br>
+ initialize(protocols);<br>
}<br>
<br>
bool ObjCObjectType::isSpecialized(<wbr>) const {<br>
<br>
<br>
______________________________<wbr>_________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="m_4891632917363646653gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">--Artem Belevich</div></div>
</div>
______________________________<wbr>_________________<br>cfe-commits mailing list<br><a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-commits</a><br></div></blockquote></div><br></div></div></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">--Artem Belevich</div></div>
</div>