LGTM. > On Dec 12, 2015, at 5:25 PM, Bruno Cardoso Lopes <bruno.card...@gmail.com> > wrote: > > bruno updated this revision to Diff 42649. > bruno added a comment. > > Thanks Duncan and Argyrios, updated a patch with the suggestions! > > > http://reviews.llvm.org/D15173 > > Files: > lib/Lex/PPCaching.cpp > test/Parser/objcxx11-protocol-in-template.mm > > Index: test/Parser/objcxx11-protocol-in-template.mm > =================================================================== > --- test/Parser/objcxx11-protocol-in-template.mm > +++ test/Parser/objcxx11-protocol-in-template.mm > @@ -8,3 +8,11 @@ > > vector<id<P>> v; > vector<vector<id<P>>> v2; > + > +@protocol PA; > +@protocol PB; > + > +@class NSArray<ObjectType>; > +typedef int some_t; > + > +id<PA> FA(NSArray<id<PB>> *h, some_t group); > Index: lib/Lex/PPCaching.cpp > =================================================================== > --- lib/Lex/PPCaching.cpp > +++ lib/Lex/PPCaching.cpp > @@ -97,8 +97,26 @@ > void Preprocessor::AnnotatePreviousCachedTokens(const Token &Tok) { > assert(Tok.isAnnotation() && "Expected annotation token"); > assert(CachedLexPos != 0 && "Expected to have some cached tokens"); > - assert(CachedTokens[CachedLexPos-1].getLastLoc() == > Tok.getAnnotationEndLoc() > - && "The annotation should be until the most recent cached token"); > + > +#ifndef NDEBUG > + Token CachedLastTok = CachedTokens[CachedLexPos - 1]; > + SourceLocation CachedLastTokLoc = CachedLastTok.getLastLoc(); > + SourceLocation TokAnnEndLoc = Tok.getAnnotationEndLoc(); > + > + // The annotation should be until the most recent cached token. Since > + // `Tok` length could be bigger than one (e.g. greatergreater '>>'), > account > + // for that cases before checking the assertion. > + if (!CachedLastTok.isAnnotation()) { > + CachedLastTokLoc = > + CachedLastTokLoc.getLocWithOffset(CachedLastTok.getLength()); > + unsigned TokAnnEndLocSize = Lexer::MeasureTokenLength( > + SourceMgr.getSpellingLoc(TokAnnEndLoc), SourceMgr, LangOpts); > + TokAnnEndLoc = TokAnnEndLoc.getLocWithOffset(TokAnnEndLocSize); > + } > + > + assert(CachedLastTokLoc == TokAnnEndLoc && > + "The annotation should be until the most recent cached token"); > +#endif > > // Start from the end of the cached tokens list and look for the token > // that is the beginning of the annotation token. > > > <D15173.42649.patch>
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits