diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2013-05-17 15:13:16 -0400 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2013-05-27 09:34:59 -0400 |
commit | 583c6a1689a7c79ab724ba4a65830b97b3cd3bec (patch) | |
tree | 2cf61e40c0a304825de7cdad861c872e9787d32b | |
parent | 2ceb67c3e94dddcdb9f8c236743f9d3d98059710 (diff) |
Implement more robust detection of before/after main file inclusion
-rw-r--r-- | odb/include.cxx | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/odb/include.cxx b/odb/include.cxx index e333a1e..152cee8 100644 --- a/odb/include.cxx +++ b/odb/include.cxx @@ -70,7 +70,7 @@ namespace struct class_: traversal::class_, context { - class_ (include_map& map): trailing_ (false), map_ (map) {} + class_ (include_map& map): main_file_loc_ (0), map_ (map) {} virtual void traverse (type& c) @@ -122,7 +122,8 @@ namespace // if (f == unit.file ()) { - trailing_ = true; + if (main_file_loc_ == 0) + main_file_loc_ = l; return; } } @@ -144,7 +145,7 @@ namespace if (map_.find (f) == map_.end ()) { includes& i (map_[f]); - i.trailing = trailing_; + i.trailing = (main_file_loc_ != 0 && l > main_file_loc_); i.map[lm] = include_directive (); } } @@ -152,7 +153,7 @@ namespace } private: - bool trailing_; + location_t main_file_loc_; include_map& map_; }; |