Files
TheRock/compiler/amd-llvm/clang/tools/clang-fuzzer/dictionary/dictionary.c
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

60 lines
1.9 KiB
C

//===-- dictionary.c - Generate fuzzing dictionary for clang --------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This binary emits a fuzzing dictionary describing strings that are
// significant to the clang parser: keywords and other tokens.
//
// The dictionary can be used by a fuzzer to reach interesting parser states
// much more quickly.
//
// The output is a single-file dictionary supported by libFuzzer and AFL:
// https://llvm.org/docs/LibFuzzer.html#dictionaries
//
//===----------------------------------------------------------------------===//
#include <stdio.h>
static void emit(const char *Name, const char *Spelling) {
static char Hex[] = "0123456789abcdef";
// Skip EmptySpellingName for IsDeducible.
if (!Name[0]) return;
printf("%s=\"", Name);
unsigned char C;
while ((C = *Spelling++)) {
if (C < 32 || C == '"' || C == '\\')
printf("\\x%c%c", Hex[C>>4], Hex[C%16]);
else
printf("%c", C);
}
printf("\"\n");
}
int main(int argc, char **argv) {
#define PUNCTUATOR(Name, Spelling) emit(#Name, Spelling);
#define KEYWORD(Name, Criteria) emit(#Name, #Name);
#define PPKEYWORD(Name) emit(#Name, #Name);
#define CXX_KEYWORD_OPERATOR(Name, Equivalent) emit(#Name, #Name);
#define OBJC_AT_KEYWORD(Name) emit(#Name, #Name);
#define ALIAS(Spelling, Equivalent, Criteria) emit(Spelling, Spelling);
#include "clang/Basic/TokenKinds.def"
// Some other sub-token chunks significant to the lexer.
emit("ucn16", "\\u0000");
emit("ucn32", "\\U00000000");
emit("rawstart", "R\"(");
emit("rawend", ")\"");
emit("quote", "\"");
emit("squote", "'");
emit("u8quote", "u8\"");
emit("u16quote", "u\"");
emit("u32quote", "U\"");
emit("esc_nl", "\\\n");
emit("hex", "0x");
}