[cfe-dev] Clang question
Robert Ankeney
rrankene at gmail.com
Sun Aug 18 05:42:26 PDT 2013
Someone recently asked about a problem with a clang tutorial from:
https://github.com/loarabia/Clang-tutorial
There was a piece of code common to many of the tutorials (since fixed in
the latest version):
CompilerInstance ci;
DiagnosticOptions diagnosticOptions;
TextDiagnosticPrinter *pTextDiagnosticPrinter =
new TextDiagnosticPrinter(
llvm::outs(),
&diagnosticOptions,
true);
ci.createDiagnostics(pTextDiagnosticPrinter);
that was causing a runtime error due to an unfreed pointer (which was
true). But looking at the code and the documentation for CompilerInstance,
it seems the line:
ci.createDiagnostics(pTextDiagnosticPrinter);
should have been:
ci.createDiagnostics(&diagnosticOptions);
and the first call should have been flagged as an error by clang.
Am I missing something obvious here?
Thanks,
Robert Ankeney
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130818/62f93a7c/attachment.html>
More information about the cfe-dev
mailing list