Files
RedBear-OS/local/recipes/dev/libclc/source/clang/lib/Index/IndexingContext.h
T
vasilito cb424d7448 build: static patch-sanity linter (shift-left the malformed-patch class)
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).
2026-08-01 05:13:02 +03:00

146 lines
4.7 KiB
C++

//===- IndexingContext.h - Indexing context data ----------------*- 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 LLVM_CLANG_LIB_INDEX_INDEXINGCONTEXT_H
#define LLVM_CLANG_LIB_INDEX_INDEXINGCONTEXT_H
#include "clang/Basic/IdentifierTable.h"
#include "clang/Basic/LLVM.h"
#include "clang/Index/IndexSymbol.h"
#include "clang/Index/IndexingAction.h"
#include "clang/Lex/MacroInfo.h"
#include "llvm/ADT/ArrayRef.h"
namespace clang {
class ASTContext;
class Decl;
class DeclGroupRef;
class ImportDecl;
class HeuristicResolver;
class TagDecl;
class TypeSourceInfo;
class NamedDecl;
class ObjCMethodDecl;
class DeclContext;
class NestedNameSpecifierLoc;
class Stmt;
class Expr;
class TypeLoc;
class SourceLocation;
namespace index {
class IndexDataConsumer;
class IndexingContext {
IndexingOptions IndexOpts;
IndexDataConsumer &DataConsumer;
ASTContext *Ctx = nullptr;
std::unique_ptr<HeuristicResolver> Resolver;
public:
IndexingContext(IndexingOptions IndexOpts, IndexDataConsumer &DataConsumer);
// Defaulted, but defined out of line to avoid a dependency on
// HeuristicResolver.h (unique_ptr requires a complete type at
// the point where its destructor is called).
~IndexingContext();
const IndexingOptions &getIndexOpts() const { return IndexOpts; }
IndexDataConsumer &getDataConsumer() { return DataConsumer; }
void setASTContext(ASTContext &ctx);
HeuristicResolver *getResolver() const { return Resolver.get(); }
bool shouldIndex(const Decl *D);
const LangOptions &getLangOpts() const;
bool shouldSuppressRefs() const {
return false;
}
bool shouldIndexFunctionLocalSymbols() const;
bool shouldIndexImplicitInstantiation() const;
bool shouldIndexParametersInDeclarations() const;
bool shouldIndexTemplateParameters() const;
static bool isTemplateImplicitInstantiation(const Decl *D);
bool handleDecl(const Decl *D, SymbolRoleSet Roles = SymbolRoleSet(),
ArrayRef<SymbolRelation> Relations = {});
bool handleDecl(const Decl *D, SourceLocation Loc,
SymbolRoleSet Roles = SymbolRoleSet(),
ArrayRef<SymbolRelation> Relations = {},
const DeclContext *DC = nullptr);
bool handleReference(const NamedDecl *D, SourceLocation Loc,
const NamedDecl *Parent, const DeclContext *DC,
SymbolRoleSet Roles = SymbolRoleSet(),
ArrayRef<SymbolRelation> Relations = {},
const Expr *RefE = nullptr);
void handleMacroDefined(const IdentifierInfo &Name, SourceLocation Loc,
const MacroInfo &MI);
void handleMacroUndefined(const IdentifierInfo &Name, SourceLocation Loc,
const MacroInfo &MI);
void handleMacroReference(const IdentifierInfo &Name, SourceLocation Loc,
const MacroInfo &MD);
bool importedModule(const ImportDecl *ImportD);
bool indexDecl(const Decl *D);
void indexTagDecl(const TagDecl *D, ArrayRef<SymbolRelation> Relations = {});
void indexTypeSourceInfo(TypeSourceInfo *TInfo, const NamedDecl *Parent,
const DeclContext *DC = nullptr,
bool isBase = false,
bool isIBType = false);
void indexTypeLoc(TypeLoc TL, const NamedDecl *Parent,
const DeclContext *DC = nullptr,
bool isBase = false,
bool isIBType = false);
void indexNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS,
const NamedDecl *Parent,
const DeclContext *DC = nullptr);
bool indexDeclContext(const DeclContext *DC);
void indexBody(const Stmt *S, const NamedDecl *Parent,
const DeclContext *DC = nullptr);
bool indexTopLevelDecl(const Decl *D);
bool indexDeclGroupRef(DeclGroupRef DG);
private:
bool shouldIgnoreIfImplicit(const Decl *D);
bool shouldIndexMacroOccurrence(bool IsRef, SourceLocation Loc);
bool handleDeclOccurrence(const Decl *D, SourceLocation Loc,
bool IsRef, const Decl *Parent,
SymbolRoleSet Roles,
ArrayRef<SymbolRelation> Relations,
const Expr *RefE,
const Decl *RefD,
const DeclContext *ContainerDC);
};
} // end namespace index
} // end namespace clang
#endif