chromium/third_party/perfetto/src/trace_processor/perfetto_sql/engine/perfetto_sql_preprocessor.cc

/*
 * Copyright (C) 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "src/trace_processor/perfetto_sql/engine/perfetto_sql_preprocessor.h"

#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <optional>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#include "perfetto/base/logging.h"
#include "perfetto/base/status.h"
#include "perfetto/ext/base/flat_hash_map.h"
#include "perfetto/ext/base/status_or.h"
#include "perfetto/ext/base/string_utils.h"
#include "src/trace_processor/sqlite/sql_source.h"
#include "src/trace_processor/sqlite/sqlite_tokenizer.h"
#include "src/trace_processor/util/status_macros.h"

namespace perfetto::trace_processor {
namespace {

enum IntrinsicMacro {};

IntrinsicMacro MacroNameToEnum(const std::string& macro_name) {}

base::Status ErrorAtToken(const SqliteTokenizer& tokenizer,
                          const SqliteTokenizer::Token& token,
                          const char* error) {}

struct InvocationArg {};

base::StatusOr<InvocationArg> ParseMacroInvocationArg(
    SqliteTokenizer& tokenizer,
    SqliteTokenizer::Token& tok,
    bool has_prev_args) {}

base::StatusOr<std::optional<SqlSource>> ExecuteStringify(
    const SqliteTokenizer& tokenizer,
    const SqliteTokenizer::Token& name_token,
    const std::vector<SqlSource>& args) {}

void RewriteIntrinsicMacro(const std::string& macro_name,
                           std::optional<SqlSource>& res,
                           std::vector<SqlSource>& token_list,
                           SqliteTokenizer& tokenizer,
                           SqlSource::Rewriter& rewriter,
                           SqliteTokenizer::Token prev,
                           SqliteTokenizer::Token tok) {}

}  // namespace

PerfettoSqlPreprocessor::PerfettoSqlPreprocessor(
    SqlSource source,
    const base::FlatHashMap<std::string, Macro>& macros)
    :{}

bool PerfettoSqlPreprocessor::NextStatement() {}

base::StatusOr<SqlSource> PerfettoSqlPreprocessor::RewriteInternal(
    const SqlSource& source,
    const std::unordered_map<std::string, SqlSource>& arg_bindings) {}

base::StatusOr<std::vector<SqlSource>> PerfettoSqlPreprocessor::ParseTokenList(
    SqliteTokenizer& tokenizer,
    SqliteTokenizer::Token& tok,
    const std::unordered_map<std::string, SqlSource>& bindings) {}

base::StatusOr<SqlSource> PerfettoSqlPreprocessor::ExecuteMacroInvocation(
    const SqliteTokenizer& tokenizer,
    const SqliteTokenizer::Token& name_token,
    const std::string& macro_name,
    std::vector<SqlSource> token_list) {}

base::StatusOr<std::optional<SqlSource>>
PerfettoSqlPreprocessor::ExecuteTokenZipJoin(
    const SqliteTokenizer& tokenizer,
    const SqliteTokenizer::Token& name_token,
    std::vector<SqlSource> token_list,
    bool prefixed) {}

base::StatusOr<std::optional<SqlSource>>
PerfettoSqlPreprocessor::ExecuteTokenApply(
    const SqliteTokenizer& tokenizer,
    const SqliteTokenizer::Token& name_token,
    std::vector<SqlSource> token_list) {}

base::StatusOr<std::optional<SqlSource>>
PerfettoSqlPreprocessor::ExecuteTokenMapJoin(
    const SqliteTokenizer& tokenizer,
    const SqliteTokenizer::Token& name_token,
    std::vector<SqlSource> token_list) {}

base::StatusOr<std::optional<SqlSource>>
PerfettoSqlPreprocessor::ExecuteTokenMapJoinWithCapture(
    const SqliteTokenizer& tokenizer,
    const SqliteTokenizer::Token& name_token,
    std::vector<SqlSource> token_list) {}

}  // namespace perfetto::trace_processor