[cfe-dev] Dynamic / Last Resort Lookup

Axel Naumann Axel.Naumann at cern.ch
Tue Feb 1 06:41:37 PST 2011


Hi,

We need to implement something similar to dynamic scopes:

void f() {
  File::Open("serialized.data");
  object->func();
}

This will call func() on an object that was retrieved from the file
serialized.data (all of it happens at runtime). The part that blocks us
from implementing it is Sema: all the lookup hooks require a predefined
set of identifiers.

Attached patch creates a last resort, dynamic lookup: if that hook
(implemented by an abstract interface) has been provided, it will get
its chance to look up a symbol but only if all the other language
foreseen lookups have failed (i.e. with lowest precedence).

We believe that the cost for clang is minimal, but for us the benefit
would be huge. Any chance that I may check it in? Of course better ideas
and / or suggestions for naming improvements are very welcome :-)

Cheers, Axel.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Sema_DynamicLookup.diff
Type: text/x-patch
Size: 4784 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110201/eeb068ec/attachment.bin>


More information about the cfe-dev mailing list