dart-sdk/runtime/vm/report.h
Ryan Macnak 6fe15f6df9 [vm] Represent tagged pointers as C++ value types instead of C++ pointer types.
This works around bugs in UndefinedBehaviorSanitizer and Clang.

Bug: b/28638298
Change-Id: I6be595f9664516019d28017d24559583a1ae3a21
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144354
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-04-25 05:21:27 +00:00

75 lines
2.5 KiB
C++

// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
#ifndef RUNTIME_VM_REPORT_H_
#define RUNTIME_VM_REPORT_H_
#include "vm/allocation.h"
#include "vm/tagged_pointer.h"
#include "vm/token_position.h"
namespace dart {
// Forward declarations.
class Error;
class ICData;
class Script;
class StackFrame;
class String;
class Report : AllStatic {
public:
enum Kind {
kWarning,
kError,
kBailout,
};
static const bool AtLocation = false;
static const bool AfterLocation = true;
// Report an already formatted error via a long jump.
DART_NORETURN static void LongJump(const Error& error);
// Concatenate and report an already formatted error and a new error message.
DART_NORETURN static void LongJumpF(const Error& prev_error,
const Script& script,
TokenPosition token_pos,
const char* format,
...) PRINTF_ATTRIBUTE(4, 5);
DART_NORETURN static void LongJumpV(const Error& prev_error,
const Script& script,
TokenPosition token_pos,
const char* format,
va_list args);
// Report a warning/jswarning/error/bailout message.
static void MessageF(Kind kind,
const Script& script,
TokenPosition token_pos,
bool report_after_token,
const char* format,
...) PRINTF_ATTRIBUTE(5, 6);
static void MessageV(Kind kind,
const Script& script,
TokenPosition token_pos,
bool report_after_token,
const char* format,
va_list args);
// Prepend a source snippet to the message.
// A null script means no source and a negative token_pos means no position.
static StringPtr PrependSnippet(Kind kind,
const Script& script,
TokenPosition token_pos,
bool report_after_token,
const String& message);
private:
DISALLOW_COPY_AND_ASSIGN(Report);
};
} // namespace dart
#endif // RUNTIME_VM_REPORT_H_