[clang] f44d28f - Fix build errors.
Manuel Klimek via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 12 00:43:38 PDT 2022
Author: Manuel Klimek
Date: 2022-07-12T07:43:26Z
New Revision: f44d28f840c0b0877b09d5547fd09e191bbdc90e
URL: https://github.com/llvm/llvm-project/commit/f44d28f840c0b0877b09d5547fd09e191bbdc90e
DIFF: https://github.com/llvm/llvm-project/commit/f44d28f840c0b0877b09d5547fd09e191bbdc90e.diff
LOG: Fix build errors.
Added:
Modified:
clang/lib/Format/MacroCallReconstructor.cpp
clang/lib/Format/Macros.h
Removed:
################################################################################
diff --git a/clang/lib/Format/MacroCallReconstructor.cpp b/clang/lib/Format/MacroCallReconstructor.cpp
index 67711cc91d0b8..ccff183cf0da1 100644
--- a/clang/lib/Format/MacroCallReconstructor.cpp
+++ b/clang/lib/Format/MacroCallReconstructor.cpp
@@ -98,7 +98,7 @@ void MacroCallReconstructor::add(FormatToken *Token,
if (!ActiveExpansions.empty() && Token->MacroCtx &&
(Token->MacroCtx->Role != MR_Hidden ||
ActiveExpansions.size() != Token->MacroCtx->ExpandedFrom.size())) {
- if (bool PassedMacroComma = reconstructActiveCallUntil(Token))
+ if (/*PassedMacroComma = */ reconstructActiveCallUntil(Token))
First = true;
}
@@ -172,7 +172,7 @@ void MacroCallReconstructor::prepareParent(FormatToken *ExpandedParent,
}
assert(!ActiveReconstructedLines.empty());
ActiveReconstructedLines.back()->Tokens.back()->Children.push_back(
- std::make_unique<Line>());
+ std::make_unique<ReconstructedLine>());
ActiveReconstructedLines.push_back(
&*ActiveReconstructedLines.back()->Tokens.back()->Children.back());
} else if (parentLine().Tokens.back()->Tok != Parent) {
@@ -498,14 +498,16 @@ void MacroCallReconstructor::finalize() {
Top.Children.resize(1);
}
-void MacroCallReconstructor::appendToken(FormatToken *Token, Line *L) {
+void MacroCallReconstructor::appendToken(FormatToken *Token,
+ ReconstructedLine *L) {
L = L ? L : currentLine();
LLVM_DEBUG(llvm::dbgs() << "-> " << Token->TokenText << "\n");
L->Tokens.push_back(std::make_unique<LineNode>(Token));
}
-UnwrappedLine MacroCallReconstructor::createUnwrappedLine(const Line &Line,
- int Level) {
+UnwrappedLine
+MacroCallReconstructor::createUnwrappedLine(const ReconstructedLine &Line,
+ int Level) {
UnwrappedLine Result;
Result.Level = Level;
for (const auto &N : Line.Tokens) {
@@ -526,7 +528,7 @@ UnwrappedLine MacroCallReconstructor::createUnwrappedLine(const Line &Line,
return Result;
}
-void MacroCallReconstructor::debug(const Line &Line, int Level) {
+void MacroCallReconstructor::debug(const ReconstructedLine &Line, int Level) {
for (int i = 0; i < Level; ++i)
llvm::dbgs() << " ";
for (const auto &N : Line.Tokens) {
@@ -544,17 +546,19 @@ void MacroCallReconstructor::debug(const Line &Line, int Level) {
llvm::dbgs() << "\n";
}
-MacroCallReconstructor::Line &MacroCallReconstructor::parentLine() {
+MacroCallReconstructor::ReconstructedLine &
+MacroCallReconstructor::parentLine() {
return **std::prev(std::prev(ActiveReconstructedLines.end()));
}
-MacroCallReconstructor::Line *MacroCallReconstructor::currentLine() {
+MacroCallReconstructor::ReconstructedLine *
+MacroCallReconstructor::currentLine() {
return ActiveReconstructedLines.back();
}
MacroCallReconstructor::MacroCallState::MacroCallState(
- MacroCallReconstructor::Line *Line, FormatToken *ParentLastToken,
- FormatToken *MacroCallLParen)
+ MacroCallReconstructor::ReconstructedLine *Line,
+ FormatToken *ParentLastToken, FormatToken *MacroCallLParen)
: Line(Line), ParentLastToken(ParentLastToken),
MacroCallLParen(MacroCallLParen) {
LLVM_DEBUG(
diff --git a/clang/lib/Format/Macros.h b/clang/lib/Format/Macros.h
index 59774647a5694..ded792c628701 100644
--- a/clang/lib/Format/Macros.h
+++ b/clang/lib/Format/Macros.h
@@ -234,13 +234,13 @@ class MacroCallReconstructor {
bool processNextReconstructed();
void finalize();
- struct Line;
+ struct ReconstructedLine;
- void appendToken(FormatToken *Token, Line *L = nullptr);
- UnwrappedLine createUnwrappedLine(const Line &Line, int Level);
- void debug(const Line &Line, int Level);
- Line &parentLine();
- Line *currentLine();
+ void appendToken(FormatToken *Token, ReconstructedLine *L = nullptr);
+ UnwrappedLine createUnwrappedLine(const ReconstructedLine &Line, int Level);
+ void debug(const ReconstructedLine &Line, int Level);
+ ReconstructedLine &parentLine();
+ ReconstructedLine *currentLine();
void debugParentMap() const;
#ifndef NDEBUG
@@ -258,13 +258,13 @@ class MacroCallReconstructor {
LineNode() = default;
LineNode(FormatToken *Tok) : Tok(Tok) {}
FormatToken *Tok = nullptr;
- llvm::SmallVector<std::unique_ptr<Line>> Children;
+ llvm::SmallVector<std::unique_ptr<ReconstructedLine>> Children;
};
// Line in which we build up the resulting unwrapped line.
// FIXME: Investigate changing UnwrappedLine to a pointer type and using it
// instead of rolling our own type.
- struct Line {
+ struct ReconstructedLine {
llvm::SmallVector<std::unique_ptr<LineNode>> Tokens;
};
@@ -277,11 +277,11 @@ class MacroCallReconstructor {
// in order to format the overall expression as a single logical line -
// if we created separate lines, we'd format them with their own top-level
// indent depending on the semantic structure, which is not desired.
- Line Result;
+ ReconstructedLine Result;
// Stack of currently "open" lines, where each line's predecessor's last
// token is the parent token for that line.
- llvm::SmallVector<Line *> ActiveReconstructedLines;
+ llvm::SmallVector<ReconstructedLine *> ActiveReconstructedLines;
// Maps from the expanded token to the token that takes its place in the
// reconstructed token stream in terms of parent-child relationships.
@@ -324,10 +324,10 @@ class MacroCallReconstructor {
llvm::SmallVector<Expansion> ActiveExpansions;
struct MacroCallState {
- MacroCallState(Line *Line, FormatToken *ParentLastToken,
+ MacroCallState(ReconstructedLine *Line, FormatToken *ParentLastToken,
FormatToken *MacroCallLParen);
- Line *Line;
+ ReconstructedLine *Line;
// The last token in the parent line or expansion, or nullptr if the macro
// expansion is on a top-level line.
More information about the cfe-commits
mailing list