[04/17] corpus: Support adding translation units with empty path
Commit Message
From: Dodji Seketeli <dodji@redhat.com>
The CTF front-end produces an artificial translation unit with an
empty path for all the types in a given ABI corpus. Adding such a
translation unit to its corpus is conditioned on it having a non-empty
path. Oops. Fixed thus.
* src/abg-corpus.cc (corpus::add): Do not require that the path of
the translation unit be non-empty.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
---
src/abg-corpus.cc | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
@@ -14,6 +14,7 @@
#include <stdexcept>
#include <unordered_map>
#include <set>
+#include <memory>
#include "abg-internal.h"
@@ -724,14 +725,11 @@ corpus::add(const translation_unit_sptr& tu)
{
ABG_ASSERT(priv_->members.insert(tu).second);
- if (!tu->get_absolute_path().empty())
- {
- // Update the path -> translation_unit map.
- string_tu_map_type::const_iterator i =
- priv_->path_tu_map.find(tu->get_absolute_path());
- ABG_ASSERT(i == priv_->path_tu_map.end());
- priv_->path_tu_map[tu->get_absolute_path()] = tu;
- }
+ // Update the path -> translation_unit map.
+ string_tu_map_type::const_iterator i =
+ priv_->path_tu_map.find(tu->get_absolute_path());
+ ABG_ASSERT(i == priv_->path_tu_map.end());
+ priv_->path_tu_map[tu->get_absolute_path()] = tu;
tu->set_corpus(this);
}