================
@@ -430,6 +430,39 @@ void Sema::ActOnFinishOfCompoundStmt() {
PopCompoundScope();
}
+// Returns the given statement as if its labels and attributes were
+// stripped, if any.
+static Stmt *GetInnermostStatement(Stmt *Outer) {
+ if (isa<LabelStmt>(Outer))
+ Outer = cast<LabelStmt>(Outer)->getInnermostLabeledStmt();
+
+ if (isa<AttributedStmt>(Outer))
+ Outer = cast<AttributedStmt>(Outer)->getSubStmt();
+
+ return Outer;
+}
+
+static StringRef GetDeferKeywordSpelling(Sema &S, SourceLocation DeferLoc) {
+ StringRef DeferSpelling =
+ S.PP.getLastMacroWithSpelling(DeferLoc, {tok::kw__Defer});
+ if (DeferSpelling.empty())
+ DeferSpelling = "_Defer";
+
+ return DeferSpelling;
+}
+
+// Diagnose if the given statement is a redundant _Defer statement.
+static void CheckRedundantDeferStmt(Sema &S, Stmt *Body) {
+ Stmt *Inner = GetInnermostStatement(Body);
+
----------------
Expertcoderz wrote:
Noted. I've cut down on some of the empty lines.
https://github.com/llvm/llvm-project/pull/225748
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits