diff options
author | Mark Spruiell <mes@zeroc.com> | 2009-03-20 09:55:55 -0700 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2009-03-20 09:55:55 -0700 |
commit | d99bc460dcabd96c089deebf8a542036fe0edc8d (patch) | |
tree | c88bf3f9b2275c5564e99a6b20737635b1cb24a4 /cpp/src | |
parent | Added APL 2.0 exception (diff) | |
download | ice-d99bc460dcabd96c089deebf8a542036fe0edc8d.tar.bz2 ice-d99bc460dcabd96c089deebf8a542036fe0edc8d.tar.xz ice-d99bc460dcabd96c089deebf8a542036fe0edc8d.zip |
bug 3916 - slice2java --list-generated bug
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Slice/FileTracker.cpp | 19 | ||||
-rw-r--r-- | cpp/src/slice2java/Main.cpp | 10 |
2 files changed, 17 insertions, 12 deletions
diff --git a/cpp/src/Slice/FileTracker.cpp b/cpp/src/Slice/FileTracker.cpp index 5c8bb1be161..2d4ce2293e4 100644 --- a/cpp/src/Slice/FileTracker.cpp +++ b/cpp/src/Slice/FileTracker.cpp @@ -90,20 +90,23 @@ Slice::FileTracker::instance() } void -Slice::FileTracker::setSource(const string& source, const string& output, bool error) +Slice::FileTracker::setSource(const string& source) { _source = source; - _errors.insert(make_pair(source, output)); + pair<map<string, list<string> >::iterator, bool> p = _generated.insert(make_pair(source, list<string>())); + assert(p.second); + _curr = p.first; +} + +void +Slice::FileTracker::setOutput(const string& output, bool error) +{ + assert(!_source.empty()); + _errors.insert(make_pair(_source, output)); if(error) { _curr = _generated.end(); } - else - { - pair<map<string, list<string> >::iterator, bool> p = _generated.insert(make_pair(source, list<string>())); - assert(p.second); - _curr = p.first; - } } void diff --git a/cpp/src/slice2java/Main.cpp b/cpp/src/slice2java/Main.cpp index e8428077d58..0ed57b5d415 100644 --- a/cpp/src/slice2java/Main.cpp +++ b/cpp/src/slice2java/Main.cpp @@ -224,12 +224,14 @@ main(int argc, char* argv[]) Slice::setErrorStream(os); } + FileTracker::instance()->setSource(*i); + Preprocessor icecpp(argv[0], *i, cppArgs); FILE* cppHandle = icecpp.preprocess(false); if(cppHandle == 0) { - FileTracker::instance()->setSource(*i, os.str(), true); + FileTracker::instance()->setOutput(os.str(), true); status = EXIT_FAILURE; break; } @@ -263,7 +265,7 @@ main(int argc, char* argv[]) if(parseStatus == EXIT_FAILURE) { p->destroy(); - FileTracker::instance()->setSource(*i, os.str(), true); + FileTracker::instance()->setOutput(os.str(), true); status = EXIT_FAILURE; } else @@ -292,7 +294,7 @@ main(int argc, char* argv[]) ChecksumMap m = createChecksums(p); copy(m.begin(), m.end(), inserter(checksums, checksums.begin())); } - FileTracker::instance()->setSource(*i, os.str(), false); + FileTracker::instance()->setOutput(os.str(), false); } catch(const Slice::FileException& ex) { @@ -302,7 +304,7 @@ main(int argc, char* argv[]) FileTracker::instance()->cleanup(); p->destroy(); os << argv[0] << ": error: " << ex.reason() << endl; - FileTracker::instance()->setSource(*i, os.str(), true); + FileTracker::instance()->setOutput(os.str(), true); status = EXIT_FAILURE; break; } |