Skip to content

Commit 9dcdaae

Browse files
authored
DPL Analysis: improve error message on wrong index dereference (#13920)
1 parent 1b5428f commit 9dcdaae

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

Framework/Core/include/Framework/ASoA.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ std::string strToUpper(std::string&& str);
4646
namespace o2::soa
4747
{
4848
void accessingInvalidIndexFor(const char* getter);
49-
void dereferenceWithWrongType();
49+
void dereferenceWithWrongType(const char* getter, const char* target);
5050
void missingFilterDeclaration(int hash, int ai);
5151
void notBoundTable(const char* tableName);
5252
} // namespace o2::soa
@@ -2473,7 +2473,7 @@ consteval auto getIndexTargets()
24732473
} \
24742474
auto t = mBinding.get<T>(); \
24752475
if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
2476-
o2::soa::dereferenceWithWrongType(); \
2476+
o2::soa::dereferenceWithWrongType(#_Getter_, #_Table_); \
24772477
} \
24782478
if (O2_BUILTIN_UNLIKELY(!has_##_Getter_())) { \
24792479
return t->emptySlice(); \
@@ -2558,7 +2558,7 @@ consteval auto getIndexTargets()
25582558
} \
25592559
auto t = mBinding.get<T>(); \
25602560
if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
2561-
o2::soa::dereferenceWithWrongType(); \
2561+
o2::soa::dereferenceWithWrongType(#_Getter_, #_Table_); \
25622562
} \
25632563
return getIterators<T>(); \
25642564
} \
@@ -2571,7 +2571,7 @@ consteval auto getIndexTargets()
25712571
} \
25722572
auto t = mBinding.get<T>(); \
25732573
if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
2574-
o2::soa::dereferenceWithWrongType(); \
2574+
o2::soa::dereferenceWithWrongType(#_Getter_, #_Table_); \
25752575
} \
25762576
return getFilteredIterators<T>(); \
25772577
} \
@@ -2617,7 +2617,7 @@ consteval auto getIndexTargets()
26172617
} \
26182618
auto t = mBinding.get<T>(); \
26192619
if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
2620-
o2::soa::dereferenceWithWrongType(); \
2620+
o2::soa::dereferenceWithWrongType(#_Getter_, #_Table_); \
26212621
} \
26222622
return t->rawIteratorAt((*mColumnIterator)[0]); \
26232623
} \
@@ -2630,7 +2630,7 @@ consteval auto getIndexTargets()
26302630
} \
26312631
auto t = mBinding.get<T>(); \
26322632
if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
2633-
o2::soa::dereferenceWithWrongType(); \
2633+
o2::soa::dereferenceWithWrongType(#_Getter_, #_Table_); \
26342634
} \
26352635
return t->rawIteratorAt((*mColumnIterator).back()); \
26362636
} \
@@ -2715,7 +2715,7 @@ consteval auto getIndexTargets()
27152715
} \
27162716
auto t = mBinding.get<T>(); \
27172717
if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
2718-
o2::soa::dereferenceWithWrongType(); \
2718+
o2::soa::dereferenceWithWrongType(#_Getter_, #_Table_); \
27192719
} \
27202720
return t->rawIteratorAt(*mColumnIterator); \
27212721
} \
@@ -2793,7 +2793,7 @@ consteval auto getIndexTargets()
27932793
} \
27942794
auto t = mBinding.get<T>(); \
27952795
if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
2796-
o2::soa::dereferenceWithWrongType(); \
2796+
o2::soa::dereferenceWithWrongType(#_Getter_, "self"); \
27972797
} \
27982798
return t->rawIteratorAt(*mColumnIterator); \
27992799
} \
@@ -2851,7 +2851,7 @@ consteval auto getIndexTargets()
28512851
{ \
28522852
auto t = mBinding.get<T>(); \
28532853
if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
2854-
o2::soa::dereferenceWithWrongType(); \
2854+
o2::soa::dereferenceWithWrongType(#_Getter_, "self"); \
28552855
} \
28562856
if (O2_BUILTIN_UNLIKELY(!has_##_Getter_())) { \
28572857
return t->emptySlice(); \
@@ -2912,7 +2912,7 @@ consteval auto getIndexTargets()
29122912
{ \
29132913
auto t = mBinding.get<T>(); \
29142914
if (O2_BUILTIN_UNLIKELY(t == nullptr)) { \
2915-
o2::soa::dereferenceWithWrongType(); \
2915+
o2::soa::dereferenceWithWrongType(#_Getter_, "self"); \
29162916
} \
29172917
return getIterators<T>(); \
29182918
} \

Framework/Core/src/ASoA.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ void accessingInvalidIndexFor(const char* getter)
2121
{
2222
throw o2::framework::runtime_error_f("Accessing invalid index for %s", getter);
2323
}
24-
void dereferenceWithWrongType()
24+
void dereferenceWithWrongType(const char* getter, const char* target)
2525
{
26-
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.");
26+
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);
2727
}
2828
void missingFilterDeclaration(int hash, int ai)
2929
{

0 commit comments

Comments
 (0)