Rose::StringUtility::toString
Generate C preprocessor #line directives.
Synopsis
Declared in <src/Rose/StringUtility/FileUtility.h>
[[visibility]]
std::string
toString(
FileWithLineNumbers const& strings,
std::string const& filename = "<unknown>",
int line = 1);
Description
Given a vector of strings with source location information, print those strings with intervening C preprocessor #line directives. For strings that have no source location, use the specified filename argument as the name of the file. The physicalLine is the line number to assume for the first line of output (the return value). The #line directives are not emitted into the return value when they're not needed (e.g., two strings are at successive line numbers of the same source file) or if ROSE has been configured to not emit #line directivies (i.e., the SKIP_HASH_LINE_NUMBER_DECLARATIONS_IN_GENERATED_FILES preprocessor symbol is defined). The strings should not have trailing linefeeds or else the output will contain extra blank lines.
Return Value
Combined string with #line directives.
Parameters
Name |
Description |
strings |
Lines with source locations. |
filename |
Default filename to use for generated lines. |
line |
Starting line number. |
Created with MrDocs