Skip to content

Commit

Permalink
DPL Analysis: improve error message on wrong index dereference (#13920)
Browse files Browse the repository at this point in the history
  • Loading branch information
aalkin authored Feb 3, 2025
1 parent 1b5428f commit 9dcdaae
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
20 changes: 10 additions & 10 deletions Framework/Core/include/Framework/ASoA.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ std::string strToUpper(std::string&& str);
namespace o2::soa
{
void accessingInvalidIndexFor(const char* getter);
void dereferenceWithWrongType();
void dereferenceWithWrongType(const char* getter, const char* target);
void missingFilterDeclaration(int hash, int ai);
void notBoundTable(const char* tableName);
} // namespace o2::soa
Expand Down Expand Up @@ -2473,7 +2473,7 @@ consteval auto getIndexTargets()
} \
auto t = mBinding.get<T>(); \
if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
o2::soa::dereferenceWithWrongType(); \
o2::soa::dereferenceWithWrongType(#_Getter_, #_Table_); \
} \
if (O2_BUILTIN_UNLIKELY(!has_##_Getter_())) { \
return t->emptySlice(); \
Expand Down Expand Up @@ -2558,7 +2558,7 @@ consteval auto getIndexTargets()
} \
auto t = mBinding.get<T>(); \
if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
o2::soa::dereferenceWithWrongType(); \
o2::soa::dereferenceWithWrongType(#_Getter_, #_Table_); \
} \
return getIterators<T>(); \
} \
Expand All @@ -2571,7 +2571,7 @@ consteval auto getIndexTargets()
} \
auto t = mBinding.get<T>(); \
if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
o2::soa::dereferenceWithWrongType(); \
o2::soa::dereferenceWithWrongType(#_Getter_, #_Table_); \
} \
return getFilteredIterators<T>(); \
} \
Expand Down Expand Up @@ -2617,7 +2617,7 @@ consteval auto getIndexTargets()
} \
auto t = mBinding.get<T>(); \
if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
o2::soa::dereferenceWithWrongType(); \
o2::soa::dereferenceWithWrongType(#_Getter_, #_Table_); \
} \
return t->rawIteratorAt((*mColumnIterator)[0]); \
} \
Expand All @@ -2630,7 +2630,7 @@ consteval auto getIndexTargets()
} \
auto t = mBinding.get<T>(); \
if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
o2::soa::dereferenceWithWrongType(); \
o2::soa::dereferenceWithWrongType(#_Getter_, #_Table_); \
} \
return t->rawIteratorAt((*mColumnIterator).back()); \
} \
Expand Down Expand Up @@ -2715,7 +2715,7 @@ consteval auto getIndexTargets()
} \
auto t = mBinding.get<T>(); \
if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
o2::soa::dereferenceWithWrongType(); \
o2::soa::dereferenceWithWrongType(#_Getter_, #_Table_); \
} \
return t->rawIteratorAt(*mColumnIterator); \
} \
Expand Down Expand Up @@ -2793,7 +2793,7 @@ consteval auto getIndexTargets()
} \
auto t = mBinding.get<T>(); \
if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
o2::soa::dereferenceWithWrongType(); \
o2::soa::dereferenceWithWrongType(#_Getter_, "self"); \
} \
return t->rawIteratorAt(*mColumnIterator); \
} \
Expand Down Expand Up @@ -2851,7 +2851,7 @@ consteval auto getIndexTargets()
{ \
auto t = mBinding.get<T>(); \
if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
o2::soa::dereferenceWithWrongType(); \
o2::soa::dereferenceWithWrongType(#_Getter_, "self"); \
} \
if (O2_BUILTIN_UNLIKELY(!has_##_Getter_())) { \
return t->emptySlice(); \
Expand Down Expand Up @@ -2912,7 +2912,7 @@ consteval auto getIndexTargets()
{ \
auto t = mBinding.get<T>(); \
if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
o2::soa::dereferenceWithWrongType(); \
o2::soa::dereferenceWithWrongType(#_Getter_, "self"); \
} \
return getIterators<T>(); \
} \
Expand Down
4 changes: 2 additions & 2 deletions Framework/Core/src/ASoA.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ void accessingInvalidIndexFor(const char* getter)
{
throw o2::framework::runtime_error_f("Accessing invalid index for %s", getter);
}
void dereferenceWithWrongType()
void dereferenceWithWrongType(const char* getter, const char* target)
{
throw o2::framework::runtime_error_f("Trying to dereference index with a wrong type in _as<>. Note that if you have several compatible index targets in your process() signature, the last one will be the one actually bound to the getter.");
throw o2::framework::runtime_error_f("Trying to dereference index with a wrong type in %s_as<T> for base target \"%s\". Note that if you have several compatible index targets in your process() signature, the last one will be the one actually bound.", getter, target);
}
void missingFilterDeclaration(int hash, int ai)
{
Expand Down

0 comments on commit 9dcdaae

Please sign in to comment.