diff --git a/src/libclang/preprocessor.cpp b/src/libclang/preprocessor.cpp index d05c739..01b8189 100644 --- a/src/libclang/preprocessor.cpp +++ b/src/libclang/preprocessor.cpp @@ -736,11 +736,17 @@ detail::preprocessor_output detail::preprocess(const libclang_compile_config& co ts::flag in_string(false), in_char(false); while (p) { - auto next = std::strpbrk(p.ptr(), "\"'#/"); // look for ", ', # or / + auto next = std::strpbrk(p.ptr(), R"(\"'#/)"); // look for \, ", ', # or / if (next && next > p.ptr()) p.bump(std::size_t(next - p.ptr() - 1)); // subtract one to get before that character - if (in_char == false && starts_with(p, "\"")) // starts with " + if (starts_with(p, R"(\\)")) // starts with two backslashes + p.bump(2u); + else if (starts_with(p, R"(\")")) // starts with \" + p.bump(2u); + else if (starts_with(p, R"(\')")) // starts with \' + p.bump(2u); + else if (in_char == false && starts_with(p, R"(")")) // starts with " { p.bump(); in_string.toggle(); @@ -752,10 +758,6 @@ detail::preprocessor_output detail::preprocess(const libclang_compile_config& co } else if (in_string == true || in_char == true) p.bump(); - else if (starts_with(p, "\\\"")) // starts with \" - p.bump(2u); - else if (starts_with(p, "\\'")) // starts with \' - p.bump(2u); else if (auto macro = parse_macro(p, result, file_depth == 0u)) { if (logger.is_verbose())