clang 20.0.0git
XRayInstr.cpp
Go to the documentation of this file.
1//===--- XRayInstr.cpp ------------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This is part of XRay, a function call instrumentation system.
10//
11//===----------------------------------------------------------------------===//
12
14#include "llvm/ADT/SmallVector.h"
15#include "llvm/ADT/StringSwitch.h"
16
17namespace clang {
18
20 XRayInstrMask ParsedKind =
21 llvm::StringSwitch<XRayInstrMask>(Value)
22 .Case("all", XRayInstrKind::All)
23 .Case("custom", XRayInstrKind::Custom)
24 .Case("function",
26 .Case("function-entry", XRayInstrKind::FunctionEntry)
27 .Case("function-exit", XRayInstrKind::FunctionExit)
28 .Case("typed", XRayInstrKind::Typed)
29 .Case("none", XRayInstrKind::None)
30 .Default(XRayInstrKind::None);
31 return ParsedKind;
32}
33
36 if (Set.Mask == XRayInstrKind::All) {
37 Values.push_back("all");
38 return;
39 }
40
41 if (Set.Mask == XRayInstrKind::None) {
42 Values.push_back("none");
43 return;
44 }
45
47 Values.push_back("custom");
48
50 Values.push_back("typed");
51
54 Values.push_back("function");
56 Values.push_back("function-entry");
57 else if (Set.has(XRayInstrKind::FunctionExit))
58 Values.push_back("function-exit");
59}
60} // namespace clang
Defines the clang::XRayInstrKind enum.
constexpr XRayInstrMask Typed
Definition: XRayInstr.h:42
constexpr XRayInstrMask FunctionExit
Definition: XRayInstr.h:40
constexpr XRayInstrMask None
Definition: XRayInstr.h:38
constexpr XRayInstrMask FunctionEntry
Definition: XRayInstr.h:39
constexpr XRayInstrMask All
Definition: XRayInstr.h:43
constexpr XRayInstrMask Custom
Definition: XRayInstr.h:41
The JSON file list parser is used to communicate input to InstallAPI.
uint32_t XRayInstrMask
Definition: XRayInstr.h:25
XRayInstrMask parseXRayInstrValue(StringRef Value)
Parses a command line argument into a mask.
Definition: XRayInstr.cpp:19
void serializeXRayInstrValue(XRayInstrSet Set, SmallVectorImpl< StringRef > &Values)
Serializes a set into a list of command line arguments.
Definition: XRayInstr.cpp:34