<div class="gmail_extra"><div class="gmail_quote">On Fri, Sep 7, 2012 at 3:43 PM, Abramo Bagnara <span dir="ltr"><<a href="mailto:abramo.bagnara@bugseng.com" target="_blank" class="cremed">abramo.bagnara@bugseng.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: abramo<br>
Date: Fri Sep 7 14:43:13 2012<br>
New Revision: 163408<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=163408&view=rev" target="_blank" class="cremed">http://llvm.org/viewvc/llvm-project?rev=163408&view=rev</a><br>
Log:<br>
Moved back getCharAndSizeNoWarn to public area.<br></blockquote><div><br></div><div>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?</div>
<div><br></div><div>Most important to my eyes would be testing the no-warn property.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Modified:<br>
cfe/trunk/include/clang/Lex/Lexer.h<br>
<br>
Modified: cfe/trunk/include/clang/Lex/Lexer.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/Lexer.h?rev=163408&r1=163407&r2=163408&view=diff" target="_blank" class="cremed">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/Lexer.h?rev=163408&r1=163407&r2=163408&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/include/clang/Lex/Lexer.h (original)<br>
+++ cfe/trunk/include/clang/Lex/Lexer.h Fri Sep 7 14:43:13 2012<br>
@@ -409,6 +409,21 @@<br>
/// \brief Returns true if the given character could appear in an identifier.<br>
static bool isIdentifierBodyChar(char c, const LangOptions &LangOpts);<br>
<br>
+ /// getCharAndSizeNoWarn - Like the getCharAndSize method, but does not ever<br>
+ /// emit a warning.<br>
+ static inline char getCharAndSizeNoWarn(const char *Ptr, unsigned &Size,<br>
+ const LangOptions &LangOpts) {<br>
+ // If this is not a trigraph and not a UCN or escaped newline, return<br>
+ // quickly.<br>
+ if (isObviouslySimpleCharacter(Ptr[0])) {<br>
+ Size = 1;<br>
+ return *Ptr;<br>
+ }<br>
+<br>
+ Size = 0;<br>
+ return getCharAndSizeSlowNoWarn(Ptr, Size, LangOpts);<br>
+ }<br>
+<br>
//===--------------------------------------------------------------------===//<br>
// Internal implementation interfaces.<br>
private:<br>
@@ -514,21 +529,6 @@<br>
/// method.<br>
char getCharAndSizeSlow(const char *Ptr, unsigned &Size, Token *Tok = 0);<br>
<br>
- /// getCharAndSizeNoWarn - Like the getCharAndSize method, but does not ever<br>
- /// emit a warning.<br>
- static inline char getCharAndSizeNoWarn(const char *Ptr, unsigned &Size,<br>
- const LangOptions &LangOpts) {<br>
- // If this is not a trigraph and not a UCN or escaped newline, return<br>
- // quickly.<br>
- if (isObviouslySimpleCharacter(Ptr[0])) {<br>
- Size = 1;<br>
- return *Ptr;<br>
- }<br>
-<br>
- Size = 0;<br>
- return getCharAndSizeSlowNoWarn(Ptr, Size, LangOpts);<br>
- }<br>
-<br>
/// getEscapedNewLineSize - Return the size of the specified escaped newline,<br>
/// or 0 if it is not an escaped newline. P[-1] is known to be a "\" on entry<br>
/// to this function.<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu" class="cremed">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank" class="cremed">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>