Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/gfx/skia/skia/src/sksl/ir/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 2 kB image not shown  

Quelle  SkSLProgram.cpp   Sprache: C

 
/*
 * Copyright 2022 Google LLC
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */


#include "src/sksl/SkSLAnalysis.h"
#include "src/sksl/SkSLPool.h"
#include "src/sksl/SkSLProgramSettings.h"
#include "src/sksl/analysis/SkSLProgramUsage.h"
#include "src/sksl/ir/SkSLFunctionDeclaration.h"
#include "src/sksl/ir/SkSLProgram.h"
#include "src/sksl/ir/SkSLProgramElement.h"
#include "src/sksl/ir/SkSLSymbol.h"
#include "src/sksl/ir/SkSLSymbolTable.h" // IWYU pragma: keep

#include <utility>

namespace SkSL {

Program::Program(std::unique_ptr<std::string> source,
                 std::unique_ptr<ProgramConfig> config,
                 std::shared_ptr<Context> context,
                 std::vector<std::unique_ptr<ProgramElement>> elements,
                 std::unique_ptr<SymbolTable> symbols,
                 std::unique_ptr<Pool> pool)
        : fSource(std::move(source))
        , fConfig(std::move(config))
        , fContext(context)
        , fSymbols(std::move(symbols))
        , fPool(std::move(pool))
        , fOwnedElements(std::move(elements)) {
    fUsage = Analysis::GetUsage(*this);
}

Program::~Program() {
    // Some or all of the program elements are in the pool. To free them safely, we must attach
    // the pool before destroying any program elements. (Otherwise, we may accidentally call
    // delete on a pooled node.)
    AutoAttachPoolToThread attach(fPool.get());

    fOwnedElements.clear();
    fContext.reset();
    fSymbols.reset();
}

std::string Program::description() const {
    std::string result = fConfig->versionDescription();
    for (const ProgramElement* e : this->elements()) {
        result += e->description();
    }
    return result;
}

const FunctionDeclaration* Program::getFunction(const char* functionName) const {
    const Symbol* symbol = fSymbols->find(functionName);
    bool valid = symbol && symbol->is<FunctionDeclaration>() &&
                 symbol->as<FunctionDeclaration>().definition();
    return valid ? &symbol->as<FunctionDeclaration>() : nullptr;
}

}  // namespace SkSL

Messung V0.5
C=90 H=93 G=91

¤ Dauer der Verarbeitung: 0.16 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.