mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
ASTPrinter: Pass the bracket options to pre and post printing callbacks.
Need this for rdar://24912860
This commit is contained in:
@@ -46,8 +46,8 @@ public:
|
||||
ClangLoader(ClangLoader) {}
|
||||
|
||||
private:
|
||||
void printDeclPre(const Decl *D) override;
|
||||
void printDeclPost(const Decl *D) override;
|
||||
void printDeclPre(const Decl *D, Optional<BracketOptions> Bracket) override;
|
||||
void printDeclPost(const Decl *D, Optional<BracketOptions> Bracket) override;
|
||||
void avoidPrintDeclPost(const Decl *D) override;
|
||||
// Forwarding implementations.
|
||||
|
||||
@@ -76,13 +76,15 @@ private:
|
||||
return OtherPrinter.printModuleRef(Mod, Name);
|
||||
}
|
||||
void printSynthesizedExtensionPre(const ExtensionDecl *ED,
|
||||
const NominalTypeDecl *NTD) override {
|
||||
return OtherPrinter.printSynthesizedExtensionPre(ED, NTD);
|
||||
const NominalTypeDecl *NTD,
|
||||
Optional<BracketOptions> Bracket) override {
|
||||
return OtherPrinter.printSynthesizedExtensionPre(ED, NTD, Bracket);
|
||||
}
|
||||
|
||||
void printSynthesizedExtensionPost(const ExtensionDecl *ED,
|
||||
const NominalTypeDecl *NTD) override {
|
||||
return OtherPrinter.printSynthesizedExtensionPost(ED, NTD);
|
||||
const NominalTypeDecl *NTD,
|
||||
Optional<BracketOptions> Bracket) override {
|
||||
return OtherPrinter.printSynthesizedExtensionPost(ED, NTD, Bracket);
|
||||
}
|
||||
|
||||
void printStructurePre(PrintStructureKind Kind, const Decl *D) override {
|
||||
@@ -706,7 +708,8 @@ void ClangCommentPrinter::avoidPrintDeclPost(const Decl *D) {
|
||||
setResumeOffset(FID, SM.getFileOffset(Loc));
|
||||
}
|
||||
|
||||
void ClangCommentPrinter::printDeclPre(const Decl *D) {
|
||||
void ClangCommentPrinter::printDeclPre(const Decl *D,
|
||||
Optional<BracketOptions> Bracket) {
|
||||
// Skip parameters, since we do not gracefully handle nested declarations on a
|
||||
// single line.
|
||||
// FIXME: we should fix that, since it also affects struct members, etc.
|
||||
@@ -720,11 +723,12 @@ void ClangCommentPrinter::printDeclPre(const Decl *D) {
|
||||
updateLastEntityLine(ClangN.getSourceRange().getBegin());
|
||||
}
|
||||
}
|
||||
return OtherPrinter.printDeclPre(D);
|
||||
return OtherPrinter.printDeclPre(D, Bracket);
|
||||
}
|
||||
|
||||
void ClangCommentPrinter::printDeclPost(const Decl *D) {
|
||||
OtherPrinter.printDeclPost(D);
|
||||
void ClangCommentPrinter::printDeclPost(const Decl *D,
|
||||
Optional<BracketOptions> Bracket) {
|
||||
OtherPrinter.printDeclPost(D, Bracket);
|
||||
|
||||
// Skip parameters; see printDeclPre().
|
||||
if (isa<ParamDecl>(D))
|
||||
|
||||
Reference in New Issue
Block a user