// Part of the Crubit project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#include "lifetime_analysis/object.h"

#include <cassert>
#include <optional>
#include <ostream>
#include <string>
#include <utility>

#include "absl/strings/str_cat.h"
#include "absl/strings/str_format.h"
#include "lifetime_annotations/function_lifetimes.h"
#include "lifetime_annotations/lifetime.h"
#include "clang/AST/Type.h"

namespace clang {
namespace tidy {
namespace lifetimes {

Object::Object(Lifetime lifetime, clang::QualType type,
               std::optional<FunctionLifetimes> func_lifetimes)
    : lifetime_(lifetime),
      type_(type),
      func_lifetimes_(std::move(func_lifetimes)) {
  assert(!type.isNull());
}

std::string Object::DebugString() const {
  std::string result = absl::StrFormat("p%p %s", this, lifetime_.DebugString());
  if (func_lifetimes_.has_value()) {
    absl::StrAppend(&result, " (fn: ", func_lifetimes_->DebugString(), ")");
  }
  if (!type_.isNull()) {
    absl::StrAppend(&result, " (", type_.getAsString(), ")");
  }
  return result;
}

std::ostream& operator<<(std::ostream& os, Object object) {
  return os << object.DebugString();
}

}  // namespace lifetimes
}  // namespace tidy
}  // namespace clang
