On Fri, Sep 7, 2012 at 3:43 PM, Abramo Bagnara <[email protected]>wrote:
> Author: abramo > Date: Fri Sep 7 14:43:13 2012 > New Revision: 163408 > > URL: http://llvm.org/viewvc/llvm-project?rev=163408&view=rev > Log: > Moved back getCharAndSizeNoWarn to public area. > If this is going to become a widely used public interface of the Lexer, could you add some unittests to cover it so we have some reasonable way of regression testing it and ensuring it isn't broken? Most important to my eyes would be testing the no-warn property. > > Modified: > cfe/trunk/include/clang/Lex/Lexer.h > > Modified: cfe/trunk/include/clang/Lex/Lexer.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/Lexer.h?rev=163408&r1=163407&r2=163408&view=diff > > ============================================================================== > --- cfe/trunk/include/clang/Lex/Lexer.h (original) > +++ cfe/trunk/include/clang/Lex/Lexer.h Fri Sep 7 14:43:13 2012 > @@ -409,6 +409,21 @@ > /// \brief Returns true if the given character could appear in an > identifier. > static bool isIdentifierBodyChar(char c, const LangOptions &LangOpts); > > + /// getCharAndSizeNoWarn - Like the getCharAndSize method, but does not > ever > + /// emit a warning. > + static inline char getCharAndSizeNoWarn(const char *Ptr, unsigned &Size, > + const LangOptions &LangOpts) { > + // If this is not a trigraph and not a UCN or escaped newline, return > + // quickly. > + if (isObviouslySimpleCharacter(Ptr[0])) { > + Size = 1; > + return *Ptr; > + } > + > + Size = 0; > + return getCharAndSizeSlowNoWarn(Ptr, Size, LangOpts); > + } > + > > > //===--------------------------------------------------------------------===// > // Internal implementation interfaces. > private: > @@ -514,21 +529,6 @@ > /// method. > char getCharAndSizeSlow(const char *Ptr, unsigned &Size, Token *Tok = > 0); > > - /// getCharAndSizeNoWarn - Like the getCharAndSize method, but does not > ever > - /// emit a warning. > - static inline char getCharAndSizeNoWarn(const char *Ptr, unsigned &Size, > - const LangOptions &LangOpts) { > - // If this is not a trigraph and not a UCN or escaped newline, return > - // quickly. > - if (isObviouslySimpleCharacter(Ptr[0])) { > - Size = 1; > - return *Ptr; > - } > - > - Size = 0; > - return getCharAndSizeSlowNoWarn(Ptr, Size, LangOpts); > - } > - > /// getEscapedNewLineSize - Return the size of the specified escaped > newline, > /// or 0 if it is not an escaped newline. P[-1] is known to be a "\" on > entry > /// to this function. > > > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits >
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
