r308185 - Fix dereference of pointers in throw statements.
Manuel Klimek via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 17 08:27:53 PDT 2017
Author: klimek
Date: Mon Jul 17 08:27:53 2017
New Revision: 308185
URL: http://llvm.org/viewvc/llvm-project?rev=308185&view=rev
Log:
Fix dereference of pointers in throw statements.
Before:
throw * x;
After:
throw *x;
Patch by Erik Uhlmann.
Modified:
cfe/trunk/lib/Format/TokenAnnotator.cpp
cfe/trunk/unittests/Format/FormatTest.cpp
Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=308185&r1=308184&r2=308185&view=diff
==============================================================================
--- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp Mon Jul 17 08:27:53 2017
@@ -1383,7 +1383,8 @@ private:
if (PrevToken->isOneOf(tok::l_paren, tok::l_square, tok::l_brace,
tok::comma, tok::semi, tok::kw_return, tok::colon,
- tok::equal, tok::kw_delete, tok::kw_sizeof) ||
+ tok::equal, tok::kw_delete, tok::kw_sizeof,
+ tok::kw_throw) ||
PrevToken->isOneOf(TT_BinaryOperator, TT_ConditionalExpr,
TT_UnaryOperator, TT_CastRParen))
return TT_UnaryOperator;
Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=308185&r1=308184&r2=308185&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Mon Jul 17 08:27:53 2017
@@ -5350,6 +5350,7 @@ TEST_F(FormatTest, UnderstandsUsesOfStar
verifyFormat("x = *a(x) = *a(y);", Left);
verifyFormat("for (;; *a = b) {\n}", Left);
verifyFormat("return *this += 1;", Left);
+ verifyFormat("throw *x;", Left);
verifyIndependentOfContext("a = *(x + y);");
verifyIndependentOfContext("a = &(x + y);");
More information about the cfe-commits
mailing list