diff options
author | Chris Lattner <sabre@nondot.org> | 2009-04-15 20:13:18 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-04-15 20:13:18 +0000 |
commit | bc9b51c3658983bc2a2380fd3d86640bd813041e (patch) | |
tree | 07fdbdd633b78597e5bdfb4e4a4f6afaa8b2681d /utils | |
parent | 688adfdd48900a43bfd66031d00983cd656e807e (diff) | |
download | external_llvm-bc9b51c3658983bc2a2380fd3d86640bd813041e.zip external_llvm-bc9b51c3658983bc2a2380fd3d86640bd813041e.tar.gz external_llvm-bc9b51c3658983bc2a2380fd3d86640bd813041e.tar.bz2 |
use escape string.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69212 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r-- | utils/TableGen/ClangDiagnosticsEmitter.cpp | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/utils/TableGen/ClangDiagnosticsEmitter.cpp b/utils/TableGen/ClangDiagnosticsEmitter.cpp index 38c4eeb..5a5f479 100644 --- a/utils/TableGen/ClangDiagnosticsEmitter.cpp +++ b/utils/TableGen/ClangDiagnosticsEmitter.cpp @@ -16,8 +16,9 @@ #include "llvm/Support/Debug.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/Streams.h" -#include "llvm/ADT/VectorExtras.h" #include "llvm/ADT/DenseSet.h" +#include "llvm/ADT/StringExtras.h" +#include "llvm/ADT/VectorExtras.h" #include <set> #include <map> using namespace llvm; @@ -39,15 +40,6 @@ static const RecordVal* findRecordVal(const Record& R, const std::string &key) { return 0; } -static void EmitEscaped(std::ostream& OS, const std::string &s) { - for (std::string::const_iterator I=s.begin(), E=s.end(); I!=E; ++I) - switch (*I) { - default: OS << *I; break; - case '\"': OS << "\\" << *I; break; - case '\\': OS << "\\\\"; break; - } -} - static void EmitAllCaps(std::ostream& OS, const std::string &s) { for (std::string::const_iterator I=s.begin(), E=s.end(); I!=E; ++I) OS << char(toupper(*I)); @@ -63,8 +55,9 @@ static void ProcessDiag(std::ostream &OS, const Record *DiagClass, OS << R.getValueAsDef("Class")->getName(); OS << ", diag::" << R.getValueAsDef("DefaultMapping")->getName(); OS << ", \""; - EmitEscaped(OS, R.getValueAsString("Text")); - OS << "\")\n"; + std::string S = R.getValueAsString("Text"); + EscapeString(S); + OS << S << "\")\n"; } void ClangDiagsDefsEmitter::run(std::ostream &OS) { @@ -168,7 +161,7 @@ static void BuildGroup(DiagnosticSet& DS, VisitedLists &Visited, void ClangDiagGroupsEmitter::run(std::ostream &OS) { // Build up a map from options to controlled diagnostics. OptionMap OM; - + const RecordVector &Opts = Records.getAllDerivedDefinitions("Option"); for (RecordVector::const_iterator I=Opts.begin(), E=Opts.end(); I != E; ++I) if (const RecordVal* V = findRecordVal(**I, "Members")) |