1 //===-- TypeValidator.cpp ---------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
14 // Other libraries and framework includes
17 #include "lldb/DataFormatters/TypeValidator.h"
18 #include "lldb/Utility/StreamString.h"
21 using namespace lldb_private;
23 TypeValidatorImpl::TypeValidatorImpl(const Flags &flags)
24 : m_flags(flags), m_my_revision(0) {}
26 TypeValidatorImpl::~TypeValidatorImpl() {}
28 TypeValidatorImpl::ValidationResult TypeValidatorImpl::Success() {
29 return ValidationResult{TypeValidatorResult::Success, ""};
32 TypeValidatorImpl::ValidationResult
33 TypeValidatorImpl::Failure(std::string message) {
34 return ValidationResult{TypeValidatorResult::Failure, message};
37 TypeValidatorImpl_CXX::TypeValidatorImpl_CXX(
38 ValidatorFunction f, std::string d, const TypeValidatorImpl::Flags &flags)
39 : TypeValidatorImpl(flags), m_description(d), m_validator_function(f) {}
41 TypeValidatorImpl_CXX::~TypeValidatorImpl_CXX() {}
43 TypeValidatorImpl::ValidationResult
44 TypeValidatorImpl_CXX::FormatObject(ValueObject *valobj) const {
46 return Success(); // I guess there's nothing wrong with a null valueobject..
48 return m_validator_function(valobj);
51 std::string TypeValidatorImpl_CXX::GetDescription() {
53 sstr.Printf("%s%s%s%s", m_description.c_str(),
54 Cascades() ? "" : " (not cascading)",
55 SkipsPointers() ? " (skip pointers)" : "",
56 SkipsReferences() ? " (skip references)" : "");
57 return sstr.GetString();