From 479d624a3abfdc81633b682e648bdc2582cde1b6 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 17 May 2013 15:13:16 -0400 Subject: Implement more robust detection of before/after main file inclusion --- odb/include.cxx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'odb/include.cxx') 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_; }; -- cgit v1.1