diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-12-21 17:30:27 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-12-21 17:31:01 +0100 |
commit | 29aec38789fa180964ce9f023c0c6808656591b5 (patch) | |
tree | eb875b9bebfa279745bba2a5c3ccbc1a08cff6fb /compilerplugins | |
parent | 6fe4ae9ae383d291c130c51ed7e0b69c3ee9ddb0 (diff) |
compilerplugins: avoid std::regex_replace
My clang 3.7 built against libstdc++ 5.2.1 doesn't seem to have it. We
can get away with a non-regex replace all here, though.
Change-Id: Iea36311d89acb434c4e4f7c1f9ce876a6ee84f42
Diffstat (limited to 'compilerplugins')
-rw-r--r-- | compilerplugins/clang/getimplementationname.cxx | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/compilerplugins/clang/getimplementationname.cxx b/compilerplugins/clang/getimplementationname.cxx index a73a7577bc4d..b918dc62da01 100644 --- a/compilerplugins/clang/getimplementationname.cxx +++ b/compilerplugins/clang/getimplementationname.cxx @@ -60,6 +60,19 @@ bool overridesXServiceInfo(clang::CXXMethodDecl const * decl) { return false; } +std::string replace_all(std::string subject, const std::string& search, const std::string& replace) +{ + size_t pos = 0; + + while ((pos = subject.find(search, pos)) != std::string::npos) + { + subject.replace(pos, search.length(), replace); + pos += replace.length(); + } + + return subject; +} + class GetImplementationName: public clang::RecursiveASTVisitor<GetImplementationName>, public loplugin::Plugin @@ -263,8 +276,8 @@ void GetImplementationName::generateOutput(FunctionDecl const * decl, const std: if(modulematch.empty()) return; const std::string module(modulematch[0]); - const std::regex doublecolonregex("::"); - const std::string cppclassweb(std::regex_replace(cppclass, doublecolonregex, "_1_1")); + const std::string doublecolonregex("::"); + const std::string cppclassweb(replace_all(cppclass, doublecolonregex, "_1_1")); std::ofstream redirectfile(m_Outdir + "/" + unoimpl + ".html"); redirectfile << "<meta http-equiv=\"refresh\" content=\"0; URL=http://docs.libreoffice.org/" << module << "/html/class" << cppclassweb << "\">\n"; redirectfile.close(); |