Add fast preprocessing mode

This commit is contained in:
Jonathan Müller 2018-02-01 18:27:33 +01:00
commit 8c426ac115
7 changed files with 442 additions and 244 deletions

View file

@ -81,7 +81,8 @@ namespace ns2
TEST_CASE("cpp_include_directive", "[!hide][clang4]")
{
write_file("cpp_include_directive-header.hpp", R"(
#define FOO
#define FOO a\
b
)");
auto header_a = R"(
@ -114,7 +115,7 @@ TEST_CASE("cpp_include_directive", "[!hide][clang4]")
REQUIRE(include.target().name() == include.name());
REQUIRE(include.include_kind() == cppast::cpp_include_kind::local);
REQUIRE(include.target().get(idx).empty());
REQUIRE(include.full_path() == "./cpp_include_directive-header.hpp");
REQUIRE(include.full_path() == "cpp_include_directive-header.hpp");
}
else
REQUIRE(false);
@ -128,7 +129,7 @@ TEST_CASE("cpp_include_directive", "[!hide][clang4]")
REQUIRE(include.include_kind() == cppast::cpp_include_kind::local);
REQUIRE(
equal_ref(idx, include.target(), cpp_file_ref(cpp_entity_id(""), "header_a.hpp")));
REQUIRE(include.full_path() == "./header_a.hpp");
REQUIRE(include.full_path() == "header_a.hpp");
}
else
REQUIRE(false);
@ -146,7 +147,7 @@ TEST_CASE("preprocessor line numbers")
#include <string>
int foo;
int var;
/// 11

View file

@ -110,7 +110,7 @@ TEST_CASE("stdlib", "[!hide][integration]")
REQUIRE(!parser.error());
REQUIRE(file);
resolve_includes(parser, file.value(), config);
REQUIRE(resolve_includes(parser, file.value(), config) == 62);
REQUIRE(!parser.error());
}
@ -125,6 +125,7 @@ TEST_CASE("cppast", "[!hide][integration]")
libclang_compilation_database database("../");
libclang_compile_config config(database, CPPAST_INTEGRATION_FILE);
config.fast_preprocessing(true);
parse_files(parser, files, config);
REQUIRE(!parser.error());