mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
HeaderToModel: emit forward declaration later
We used to emit the forward declaration for the type we were editing *before* `#pragma once`. This was not good per se, but it also lead to failures due to the introduction of `_PACKED`, which is not yet defined at that stage.
This commit is contained in:
@@ -154,12 +154,13 @@ struct ImportModelFromCAnalysis {
|
||||
if (not isa<model::RawFunctionType>(*TypeToEdit)
|
||||
and not isa<model::CABIFunctionType>(*TypeToEdit)
|
||||
and not isa<model::TypedefType>(*TypeToEdit)) {
|
||||
llvm::raw_string_ostream Stream(Options.PostIncludes);
|
||||
ptml::PTMLCBuilder ThePTMLCBuilder(true);
|
||||
ptml::PTMLIndentedOstream ThePTMLStream(Header, 4, true);
|
||||
Header << ThePTMLCBuilder.getLineComment("The type we are editing.");
|
||||
ptml::PTMLIndentedOstream ThePTMLStream(Stream, 4, true);
|
||||
Stream << ThePTMLCBuilder.getLineComment("The type we are editing");
|
||||
// The definition of this type will be at the end of the file.
|
||||
printForwardDeclaration(**TypeToEdit, ThePTMLStream, ThePTMLCBuilder);
|
||||
Header << '\n';
|
||||
Stream << '\n';
|
||||
}
|
||||
|
||||
// Find all types whose definition depends on the type we are editing.
|
||||
|
||||
Reference in New Issue
Block a user