-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[cling] TransactionUnloader: ensure function instantiations are proce…
…ssed only once Implicit instantiation of a function template calls `DeclCollector::HandleCXXImplicitFunctionInstantiation()`, which appends the FunctionDecl to the transaction. According to clang documentation, the body of the function has not yet been instantiated. `HandleTopLevelDecl()` will be called again for this decl at the end of the TU, which will append it again to the transaction - same `Decl *`, different ConsumerCallInfo. This is by design. However, unloading of decls in the transaction should not process the same `Decl *` twice. In particular, entries with ConsumerCallInfo == `kCCIHandleCXXImplicitFunctionInstantiation` will omitted. Fixes issue #9850.
- Loading branch information
1 parent
4b22703
commit cd9d087
Showing
3 changed files
with
30 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
template <typename T> T square(T x) { | ||
// This unused lambda caused a crash if the file is unloaded; see | ||
// https://github.com/root-project/root/issues/9850 | ||
auto lambda = [](double x) { return x; }; | ||
return x * x; | ||
} | ||
|
||
void templatedfunc() { | ||
printf("%d\n", square(2)); | ||
} |