Created
April 3, 2017 20:34
-
-
Save darktears/7988e2ee71df2d7f65314c950f02e408 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/tools/gn/visual_studio_writer.cc b/tools/gn/visual_studio_writer.cc | |
index 8a8cf528fc15..59d27bf6a0be 100644 | |
--- a/tools/gn/visual_studio_writer.cc | |
+++ b/tools/gn/visual_studio_writer.cc | |
@@ -9,6 +9,7 @@ | |
#include <map> | |
#include <memory> | |
#include <queue> | |
+#include <regex> | |
#include <set> | |
#include <string> | |
@@ -37,9 +38,10 @@ | |
namespace { | |
-struct SemicolonSeparatedWriter { | |
+struct SemicolonSeparatedAndSpecialCharacterConverterWriter { | |
void operator()(const std::string& value, std::ostream& out) const { | |
- out << value + ';'; | |
+ std::string result = std::regex_replace(value, std::regex("<<"), "%3C%3C"); | |
+ out << result + ';'; | |
} | |
}; | |
@@ -545,7 +547,8 @@ bool VisualStudioWriter::WriteProjectFileContents( | |
std::unique_ptr<XmlElementWriter> preprocessor_definitions = | |
cl_compile->SubElement("PreprocessorDefinitions"); | |
RecursiveTargetConfigToStream<std::string>( | |
- target, &ConfigValues::defines, SemicolonSeparatedWriter(), | |
+ target, &ConfigValues::defines, | |
+ SemicolonSeparatedAndSpecialCharacterConverterWriter(), | |
preprocessor_definitions->StartContent(false)); | |
preprocessor_definitions->Text("%(PreprocessorDefinitions)"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment