[cfe-commits] r140039 - in /cfe/trunk: include/clang/Parse/Parser.h lib/Parse/ParseExprCXX.cpp lib/Parse/ParseStmt.cpp test/Parser/cxx-casting.cpp

Erik Verbruggen erik.verbruggen at me.com
Tue Sep 20 03:47:10 PDT 2011



On 19 Sep, 2011,at 09:01 PM, Richard Trieu <rtrieu at google.com> wrote:

--- cfe/trunk/lib/Parse/ParseExprCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExprCXX.cpp Mon Sep 19 14:01:00 2011
@@ -70,6 +70,31 @@
PP.EnterToken(DigraphToken);
}

+// Check for '<::' which should be '< ::' instead of '[:' when following
+// a template name.
+void Parser::CheckForTemplateAndDigraph(Token &Next, ParsedType ObjectType,
+ bool EnteringContext,
+ IdentifierInfo &II, CXXScopeSpec &SS) {
+ if (!Next.is(tok::l_square) || !Next.getLength() == 2)
+ return;

Is that second exclamation mark right? I think you wanted to write:
...   !(Next.getLength() == 2))

Or:
...   Next.getLength() != 2)

Right? Because now you are applying the ! operator to the length...

The current code gives a warning on MSVC:

C:\data\clang-llvm\llvm\tools\clang\lib\Parse\ParseExprCXX.cpp(78) : warning C4806: '==' : unsafe operation: no value of
 type 'bool' promoted to type 'int' can equal the given constant

So when you are implementing warnings, it would be nice if clang did something along those lines. ;-)

-- Erik.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110920/ba2f1338/attachment.html>


More information about the cfe-commits mailing list