cb424d7448
verify-patch-sanity.py validates every active recipe .patch has internally- consistent hunk line counts — catching the 'malformed patch at line N' failure at commit/CI/preflight time instead of hours into a cook. This cycle hit that class three times (qtwaylandscanner, sddm, xwayland), each only discovered when cookbook tried to apply the patch. Running it across the repo found 29 latent malformed patches (validated against GNU patch: e.g. relibc/P3-sysv-ipc reproduces 'malformed patch at line 22'). They were harmless only because they sit in vendored recipes (baked, not re- applied) — but would fail on any version-bump re-derivation. --fix recounts the hunk headers (body untouched) and repaired all 29. Wired into build-preflight.sh (Phase 1.0D) and redbear-ci.yml, with a unit test (test-patch-sanity.sh). Skips archived/legacy trees and unvalidatable formats (empty placeholders, bare-@@ git hunks).
60 lines
1.6 KiB
C++
60 lines
1.6 KiB
C++
//===--- QueryParser.h - ----------------------------------------*- C++ -*-===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef MLIR_TOOLS_MLIRQUERY_QUERYPARSER_H
|
|
#define MLIR_TOOLS_MLIRQUERY_QUERYPARSER_H
|
|
|
|
#include "Matcher/Parser.h"
|
|
#include "mlir/Query/Query.h"
|
|
#include "mlir/Query/QuerySession.h"
|
|
|
|
#include "llvm/ADT/StringRef.h"
|
|
#include "llvm/LineEditor/LineEditor.h"
|
|
|
|
namespace mlir::query {
|
|
|
|
class QuerySession;
|
|
|
|
class QueryParser {
|
|
public:
|
|
// Parse line as a query and return a QueryRef representing the query, which
|
|
// may be an InvalidQuery.
|
|
static QueryRef parse(llvm::StringRef line, const QuerySession &qs);
|
|
|
|
static std::vector<llvm::LineEditor::Completion>
|
|
complete(llvm::StringRef line, size_t pos, const QuerySession &qs);
|
|
|
|
private:
|
|
QueryParser(llvm::StringRef line, const QuerySession &qs)
|
|
: line(line), completionPos(nullptr), qs(qs) {}
|
|
|
|
llvm::StringRef lexWord();
|
|
|
|
template <typename T>
|
|
struct LexOrCompleteWord;
|
|
|
|
QueryRef completeMatcherExpression();
|
|
|
|
QueryRef endQuery(QueryRef queryRef);
|
|
|
|
// Parse [begin, end) and returns a reference to the parsed query object,
|
|
// which may be an InvalidQuery if a parse error occurs.
|
|
QueryRef doParse();
|
|
|
|
llvm::StringRef line;
|
|
|
|
const char *completionPos;
|
|
std::vector<llvm::LineEditor::Completion> completions;
|
|
|
|
const QuerySession &qs;
|
|
};
|
|
|
|
} // namespace mlir::query
|
|
|
|
#endif // MLIR_TOOLS_MLIRQUERY_QUERYPARSER_H
|