chromium/third_party/perfetto/src/trace_processor/sqlite/sql_source.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/sqlite/sql_source.h"

#include <sqlite3.h>
#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <iterator>
#include <limits>
#include <optional>
#include <string>
#include <string_view>
#include <utility>
#include <vector>

#include "perfetto/base/logging.h"
#include "perfetto/ext/base/string_utils.h"

#if SQLITE_VERSION_NUMBER < 3041002
// There is a bug in pre-3.41.2 versions of SQLite where sqlite3_error_offset
// can return an offset out of bounds. Make it a hard compiler error to prevent
// us from hitting this bug.
#error "SQLite version is too old."
#endif

namespace perfetto::trace_processor {

namespace {

std::pair<uint32_t, uint32_t> GetLineAndColumnForOffset(const std::string& sql,
                                                        uint32_t line,
                                                        uint32_t column,
                                                        uint32_t offset) {}

std::pair<std::string, size_t> SqlContextAndCaretPos(const std::string& sql,
                                                     uint32_t offset) {}

}  // namespace

SqlSource::SqlSource() = default;
SqlSource::SqlSource(Node node) :{}

SqlSource::SqlSource(std::string sql,
                     std::string name,
                     bool include_traceback_header) {}

SqlSource SqlSource::FromExecuteQuery(std::string sql) {}

SqlSource SqlSource::FromMetric(std::string sql, const std::string& name) {}

SqlSource SqlSource::FromMetricFile(std::string sql, const std::string& name) {}

SqlSource SqlSource::FromModuleInclude(std::string sql,
                                       const std::string& module) {}

SqlSource SqlSource::FromTraceProcessorImplementation(std::string sql) {}

std::string SqlSource::AsTraceback(uint32_t offset) const {}

std::string SqlSource::AsTracebackForSqliteOffset(
    std::optional<uint32_t> opt_offset) const {}

SqlSource SqlSource::Substr(uint32_t offset, uint32_t len) const {}

SqlSource SqlSource::RewriteAllIgnoreExisting(SqlSource source) const {}

std::string SqlSource::ApplyRewrites(const std::string& original_sql,
                                     const std::vector<Rewrite>& rewrites) {}

std::string SqlSource::Node::AsTraceback(uint32_t rewritten_offset) const {}

std::string SqlSource::Node::SelfTraceback(uint32_t rewritten_offset,
                                           uint32_t original_offset) const {}

SqlSource::Node SqlSource::Node::Substr(uint32_t offset, uint32_t len) const {}

uint32_t SqlSource::Node::RewrittenOffsetToOriginalOffset(
    uint32_t rewritten_offset) const {}

std::optional<uint32_t> SqlSource::Node::RewriteForOriginalOffset(
    uint32_t original_offset) const {}

SqlSource::Rewriter::Rewriter(SqlSource source)
    :{}
SqlSource::Rewriter::Rewriter(Node source) :{}

void SqlSource::Rewriter::Rewrite(uint32_t rewritten_start,
                                  uint32_t rewritten_end,
                                  SqlSource source) {}

SqlSource SqlSource::Rewriter::Build() && {}

}  // namespace perfetto::trace_processor