template <class Diagnostics>

class ScopedModuleDiagnostics

Defined at line 132 of file ../../sdk/lib/ld/include/lib/ld/diagnostics.h

This is an RAII type for use with some Diagnostics type whose Report type is

an ld::ModuleDiagnosticsReportBase subclass. It exists to temporarily set

the module name in the Diagnostics::report() object. The report().module()

must be empty when this is constructed; it's cleared when this is destroyed.

So it's used as in:

```

bool LinkingStuffForModule(Diagnostics

&

diag, Module

&

module) {

ld::ScopedModuleDiagnostics module_diag{diag, module.name().str()};

if (!DoSomeLinking(diag, module)) {

return false;

}

return DoSomeMoreLinking(diag, module);

}

```

That is, the `ld::ModuleDiagnostics` object is allowed to go out of scope

and be destroyed before using the Diagnostics object for things that

shouldn't be prefixed with this module name.

Public Methods

void ScopedModuleDiagnostics<Diagnostics> (Diagnostics & diag, std::string_view name)

Defined at line 134 of file ../../sdk/lib/ld/include/lib/ld/diagnostics.h

void ~ScopedModuleDiagnostics<Diagnostics> ()

Defined at line 140 of file ../../sdk/lib/ld/include/lib/ld/diagnostics.h