cling/test/CodeUnloading/RereadFile.C
Javier Lopez-Gomez 9d09611d77 TransactionUnloader: ensure function instantiations are processed 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.
2022-03-03 18:29:03 +01:00

36 lines
902 B
C

//------------------------------------------------------------------------------
// CLING - the C++ LLVM-based InterpreterG :)
//
// This file is dual-licensed: you can choose to license it under the University
// of Illinois Open Source License or the GNU Lesser General Public License. See
// LICENSE.TXT for details.
//------------------------------------------------------------------------------
// RUN: cat %s | %cling -I%p 2>&1 | FileCheck %s
// Test that we re-read file, e.g. that we uncache symbols and file content.
extern "C" int printf(const char*,...);
// work around ROOT-8240
42 // CHECK: (int) 42
// ROOT-7858: forget symbols
.L macro1.h
macro() // CHECK: version 1
//CHECK: (int) 1
.U macro1.h
.L macro2.h
macro() // CHECK: 2.version 2
//CHECK: (int) 2
.x unnamedns.h
//CHECK: 13
.x unnamedns.h
//CHECK-NEXT: 13
.x templatedfunc.h
//CHECK: 4
.x templatedfunc.h
//CHECK-NEXT: 4