mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-25 19:50:12 +01:00
This should clean up our top level directory and the build patterns. No non-mechanical edits here. Just injecting `toolchain/` and `TOOLCHAIN_` and then running formatting tools.
32 lines
962 B
C++
32 lines
962 B
C++
// Part of the Carbon Language 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 <cstdint>
|
|
#include <cstring>
|
|
|
|
#include "llvm/ADT/StringRef.h"
|
|
#include "toolchain/diagnostics/diagnostic_emitter.h"
|
|
#include "toolchain/diagnostics/null_diagnostics.h"
|
|
#include "toolchain/lexer/numeric_literal.h"
|
|
|
|
namespace Carbon {
|
|
|
|
// NOLINTNEXTLINE: Match the documented fuzzer entry point declaration style.
|
|
extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data,
|
|
std::size_t size) {
|
|
auto token = LexedNumericLiteral::Lex(
|
|
llvm::StringRef(reinterpret_cast<const char*>(data), size));
|
|
if (!token) {
|
|
// Lexically not a numeric literal.
|
|
return 0;
|
|
}
|
|
|
|
volatile auto value =
|
|
token->ComputeValue(NullDiagnosticEmitter<const char*>());
|
|
(void)value;
|
|
return 0;
|
|
}
|
|
|
|
} // namespace Carbon
|