1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 06:02:11 +02:00

Bug 543947: Fix exception while formatting macro

Change-Id: If3e1a4da919c4e7f78ca4506e97ea1f6f37f7c8c
Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com>
This commit is contained in:
Marco Stornelli 2019-03-06 19:08:17 +01:00
parent f28b158828
commit 3113871624
2 changed files with 32 additions and 1 deletions

View file

@ -3556,7 +3556,8 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor,
} }
for (ICPPASTNameSpecifier nameSpec : node.getQualifier()) { for (ICPPASTNameSpecifier nameSpec : node.getQualifier()) {
nameSpec.accept(this); nameSpec.accept(this);
scribe.printNextToken(Token.tCOLONCOLON); if (peekNextToken() == Token.tCOLONCOLON)
scribe.printNextToken(Token.tCOLONCOLON);
} }
if (peekNextToken() == Token.tCOMPL) { if (peekNextToken() == Token.tCOMPL) {
// destructor // destructor

View file

@ -3781,4 +3781,34 @@ public class CodeFormatterTest extends BaseUITestCase {
public void testTemplateInstantiationOperatorLesser_Bug540252() throws Exception { public void testTemplateInstantiationOperatorLesser_Bug540252() throws Exception {
assertFormatterResult(); assertFormatterResult();
} }
//#define WW(x) std::ostringstream(x)
//namespace some_namespace
//{
// void func()
// {
// try
// {
// WW("1") << "2";
// }
// catch (const std::exception& e)
// {
// std::cout << "blah...." << std::endl;
// }
// }
//}
//#define WW(x) std::ostringstream(x)
//namespace some_namespace {
//void func() {
// try {
// WW("1") << "2";
// } catch (const std::exception& e) {
// std::cout << "blah...." << std::endl;
// }
//}
//}
public void testFormmatterWithMacro_Bug543947() throws Exception {
assertFormatterResult();
}
} }