Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 367117 - [formatter] cdt hangs when formatting c++ code
Summary: [formatter] cdt hangs when formatting c++ code
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-editor (show other bugs)
Version: 7.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 8.0.2   Edit
Assignee: Sergey Prigogin CLA
QA Contact: Anton Leherbauer CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-19 13:07 EST by Elena Laskavaia CLA
Modified: 2011-12-21 13:46 EST (History)
2 users (show)

See Also:


Attachments
sampe code (2.14 KB, text/plain)
2011-12-19 14:56 EST, Elena Laskavaia CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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.