mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-02 20:15:34 +00:00
Track included files in PATH-agnostic way. (#4329)
* Track included files in PATH-agnostic way. Use full paths as keys in the map of included files. Store logical include path as a value, in order to put it to the generated file. * Fix tests by accepting null |include_filename|. * Fix self-includes code generators.
This commit is contained in:
committed by
Wouter van Oortmerssen
parent
22743ca45a
commit
642254bee6
@@ -72,14 +72,15 @@ class CppGenerator : public BaseGenerator {
|
||||
}
|
||||
for (auto it = parser_.included_files_.begin();
|
||||
it != parser_.included_files_.end(); ++it) {
|
||||
auto noext = flatbuffers::StripExtension(it->first);
|
||||
if (it->second.empty())
|
||||
continue;
|
||||
auto noext = flatbuffers::StripExtension(it->second);
|
||||
auto basename = flatbuffers::StripPath(noext);
|
||||
if (basename != file_name_) {
|
||||
code_ += "#include \"" + parser_.opts.include_prefix +
|
||||
(parser_.opts.keep_include_path ? noext : basename) +
|
||||
"_generated.h\"";
|
||||
num_includes++;
|
||||
}
|
||||
|
||||
code_ += "#include \"" + parser_.opts.include_prefix +
|
||||
(parser_.opts.keep_include_path ? noext : basename) +
|
||||
"_generated.h\"";
|
||||
num_includes++;
|
||||
}
|
||||
if (num_includes) code_ += "";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user