You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, cling uses cling::utils::getWrapPoint() to cut the input line in two parts: one that will become part of an internal wrapper function (i.e., __cling_Un1Qu3xxx) and the other that will not.
This mechanism is overly simplistic and cannot correctly handle some cases, e.g. users would expect that the excerpts below are equivalent, however,
root [0] namespacefoo { int i; }
root [1] usingnamespacefoo; std::cout << "hello\n";
hello
root [2] i
(int) 0
translates into do not wrap using namespace foo; and wrap std::cout << "hello\n";, while
root [0] namespacefoo { int i; }
root [1] std::cout << "hello\n"; usingnamespacefoo;
hello
root [2] i
input_line_11:2:3: error: use of undeclared identifier 'i'
(i)
^
will wrap all the input. Therefore, the using directive is not parsed at the TU level.
Also, this function adds missing ; for some cases, but the current support is somewhat limited (see related issue #8064).
Optional: share how it could be improved
Cling should cut the input line in several independent fragments that will be either wrapped or directly parsed by clang. Additionally, these fragments shall incorporate some marks, such as "needs wrapper" or "needs terminating semicolon". The proposed solution might also add the terminating ; where required, if requested.
The text was updated successfully, but these errors were encountered:
Explain what you would like to see improved
Currently, cling uses
cling::utils::getWrapPoint()
to cut the input line in two parts: one that will become part of an internal wrapper function (i.e.,__cling_Un1Qu3xxx
) and the other that will not.This mechanism is overly simplistic and cannot correctly handle some cases, e.g. users would expect that the excerpts below are equivalent, however,
translates into do not wrap
using namespace foo;
and wrapstd::cout << "hello\n";
, whilewill wrap all the input. Therefore, the
using
directive is not parsed at the TU level.Also, this function adds missing
;
for some cases, but the current support is somewhat limited (see related issue #8064).Optional: share how it could be improved
Cling should cut the input line in several independent fragments that will be either wrapped or directly parsed by clang. Additionally, these fragments shall incorporate some marks, such as "needs wrapper" or "needs terminating semicolon". The proposed solution might also add the terminating
;
where required, if requested.The text was updated successfully, but these errors were encountered: