Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 367117

Summary: [formatter] cdt hangs when formatting c++ code
Product: [Tools] CDT Reporter: Elena Laskavaia <elaskavaia.cdt>
Component: cdt-editorAssignee: Sergey Prigogin <eclipse.sprigogin>
Status: RESOLVED FIXED QA Contact: Anton Leherbauer <aleherb+eclipse>
Severity: normal    
Priority: P3 CC: cdtdoug, eclipse.sprigogin
Version: 7.0   
Target Milestone: 8.0.2   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
sampe code none

Description Elena Laskavaia CLA 2011-12-19 13:07:36 EST
This is the c++ source code
----
string DeviceInfo::toString() const {
        return  "Device Name: " + getProperty(DEVICE_NAME) + "\n" +
                        "Device PIN: " + getProperty(PIN) + "\n" +
                        "Handheld Model: " + getDeviceType() + "\n" +
                        "SIM Home Network: " + getProperty(SPN) + "\n" +
                        "Hardware ID: " + getProperty(HARDWARE_ID) + "\n" +
                        "Serial Number: " + getProperty(DEVICE_SERIAL_NUMBER) + "\n" +
                        "Vendor ID: " + getProperty(VENDER_ID) + "\n" +
                        "CPU Type: " + getProperty(CPU_TYPE) + "\n" +
                        "Processor Type: " + getProperty(PROCESSOR_TYPE) + "\n" +
                        "Motherboard Revision: " + getProperty(BOARD_REV) + "\n" +
                        "RAM Size: " + getProperty(RAM_SIZE) + "\n" +
                        "Wifi Status: " + getProperty(WIFI_POWER) + "\n" +
                        "Disk size: " + getProperty(DISK_SIZE) + "\n" +
                        "Secure Device: " + getProperty(SECURE_DEVICE) + "\n" +
                        "In Production: " + getProperty(IN_PRODUCTION) + "\n" +
                        "Bootrom Build Date: " + getProperty(BOOTROM_BUILD_DATE) + "\n" +
                        "OS Version: " + getProperty(HH_APPS_VERSION_PPS_OBJ_NAME) + "\n" +
                        "Bundle Number: " + getProperty(BUNDLE_NUMBER_NAME) + "\n" +
                        "Build Type: " + getProperty(BUILD_TYPE_NAME) + "\n" +
                        "Platform Version: " + getProperty(PLATFORM_VERSION_PPS_OBJ_NAME) + "\n" +
                        "Display Language: " + getProperty(DISPLAY_LANGUAGE_NAME) + "\n" +
                        "Input Language: " + getProperty(INPUT_LANG_PPS_JSON_NAME) + "\n" +
                        "SCM Version Found In: Coming Soon!\n";

}
------

Try to format it - CDT hangs forever (formatter is called in main loop)
Comment 1 Elena Laskavaia CLA 2011-12-19 14:37:33 EST
Note: this sample does not compile but it will still hang the CDT if formatted invoked, and it should not be happening
Comment 2 Elena Laskavaia CLA 2011-12-19 14:56:10 EST
Created attachment 208577 [details]
sampe code

Attach self-compiling code sample - same issue
Comment 3 Sergey Prigogin CLA 2011-12-19 23:07:42 EST
(In reply to comment #2)
With the attached code formatting did complete and produced correct results, but took almost a minute. The problem is that the algorithm is very inefficient for very deep nested expressions. I'll try to optimize it for most common cases.
Comment 4 Sergey Prigogin CLA 2011-12-21 13:46:31 EST
Fixed in cdt_8_0 and master.