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).
80 lines
2.8 KiB
C++
80 lines
2.8 KiB
C++
//===-- lib/Semantics/openmp-utils.h --------------------------------------===//
|
|
//
|
|
// 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
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// Common utilities used in OpenMP semantic checks.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef FORTRAN_SEMANTICS_OPENMP_UTILS_H
|
|
#define FORTRAN_SEMANTICS_OPENMP_UTILS_H
|
|
|
|
#include "flang/Evaluate/type.h"
|
|
#include "flang/Parser/char-block.h"
|
|
#include "flang/Parser/parse-tree.h"
|
|
#include "flang/Semantics/tools.h"
|
|
|
|
#include "llvm/ADT/ArrayRef.h"
|
|
|
|
#include <optional>
|
|
#include <string>
|
|
|
|
namespace Fortran::semantics {
|
|
class SemanticsContext;
|
|
class Symbol;
|
|
|
|
// Add this namespace to avoid potential conflicts
|
|
namespace omp {
|
|
// There is no consistent way to get the source of an ActionStmt, but there
|
|
// is "source" in Statement<T>. This structure keeps the ActionStmt with the
|
|
// extracted source for further use.
|
|
struct SourcedActionStmt {
|
|
const parser::ActionStmt *stmt{nullptr};
|
|
parser::CharBlock source;
|
|
|
|
operator bool() const { return stmt != nullptr; }
|
|
};
|
|
|
|
SourcedActionStmt GetActionStmt(const parser::ExecutionPartConstruct *x);
|
|
SourcedActionStmt GetActionStmt(const parser::Block &block);
|
|
|
|
std::string ThisVersion(unsigned version);
|
|
std::string TryVersion(unsigned version);
|
|
|
|
const parser::Designator *GetDesignatorFromObj(const parser::OmpObject &object);
|
|
const parser::DataRef *GetDataRefFromObj(const parser::OmpObject &object);
|
|
const parser::ArrayElement *GetArrayElementFromObj(
|
|
const parser::OmpObject &object);
|
|
const Symbol *GetObjectSymbol(const parser::OmpObject &object);
|
|
const Symbol *GetArgumentSymbol(const parser::OmpArgument &argument);
|
|
std::optional<parser::CharBlock> GetObjectSource(
|
|
const parser::OmpObject &object);
|
|
|
|
bool IsCommonBlock(const Symbol &sym);
|
|
bool IsExtendedListItem(const Symbol &sym);
|
|
bool IsVariableListItem(const Symbol &sym);
|
|
bool IsVarOrFunctionRef(const MaybeExpr &expr);
|
|
|
|
std::optional<SomeExpr> GetEvaluateExpr(const parser::Expr &parserExpr);
|
|
std::optional<evaluate::DynamicType> GetDynamicType(
|
|
const parser::Expr &parserExpr);
|
|
|
|
std::optional<bool> IsContiguous(
|
|
SemanticsContext &semaCtx, const parser::OmpObject &object);
|
|
|
|
std::vector<SomeExpr> GetAllDesignators(const SomeExpr &expr);
|
|
const SomeExpr *HasStorageOverlap(
|
|
const SomeExpr &base, llvm::ArrayRef<SomeExpr> exprs);
|
|
bool IsSubexpressionOf(const SomeExpr &sub, const SomeExpr &super);
|
|
bool IsAssignment(const parser::ActionStmt *x);
|
|
bool IsPointerAssignment(const evaluate::Assignment &x);
|
|
const parser::Block &GetInnermostExecPart(const parser::Block &block);
|
|
} // namespace omp
|
|
} // namespace Fortran::semantics
|
|
|
|
#endif // FORTRAN_SEMANTICS_OPENMP_UTILS_H
|