diff options
author | Chris Lattner <sabre@nondot.org> | 2008-11-19 06:04:55 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-11-19 06:04:55 +0000 |
commit | 8d5bec4c7dd2932396d624c4a73cea98da5da6ab (patch) | |
tree | f4122114de2c856774ecffd5c91be0374a1c3b04 /clang/lib | |
parent | 1431331b47b6253cc2a9019b65ad3a3093dcda80 (diff) | |
download | bcm5719-llvm-8d5bec4c7dd2932396d624c4a73cea98da5da6ab.tar.gz bcm5719-llvm-8d5bec4c7dd2932396d624c4a73cea98da5da6ab.zip |
implement a transparent optimization with the diagnostics stuff:
const char*'s are now not converted to std::strings when the diagnostic
is formed, we just hold onto their pointer and format as needed.
This commit makes DiagnosticClient::FormatDiagnostic even more of a
mess, I'll fix it in the next commit.
llvm-svn: 59593
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Basic/Diagnostic.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Basic/Diagnostic.cpp b/clang/lib/Basic/Diagnostic.cpp index a202a55f268..35d454b1b9a 100644 --- a/clang/lib/Basic/Diagnostic.cpp +++ b/clang/lib/Basic/Diagnostic.cpp @@ -255,7 +255,8 @@ std::string DiagnosticClient::FormatDiagnostic(const DiagnosticInfo &Info) { if (Msg[i] == '%' && isdigit(Msg[i + 1])) { unsigned StrNo = Msg[i + 1] - '0'; Msg = std::string(Msg.begin(), Msg.begin() + i) + - Info.getArgStr(StrNo) + + (Info.getArgKind(StrNo) == DiagnosticInfo::ak_std_string ? + Info.getArgStdStr(StrNo) : std::string(Info.getArgCStr(StrNo))) + std::string(Msg.begin() + i + 2, Msg.end()); } } |