Dean Michael Berris | 488f7c2 | 2018-04-13 02:31:58 +0000 | [diff] [blame] | 1 | //===--- XRayInstr.cpp ------------------------------------------*- C++ -*-===// |
| 2 | // |
Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 +0000 | [diff] [blame] | 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 |
Dean Michael Berris | 488f7c2 | 2018-04-13 02:31:58 +0000 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | // |
| 9 | // This is part of XRay, a function call instrumentation system. |
| 10 | // |
| 11 | //===----------------------------------------------------------------------===// |
| 12 | |
| 13 | #include "clang/Basic/XRayInstr.h" |
| 14 | #include "llvm/ADT/StringSwitch.h" |
| 15 | |
| 16 | namespace clang { |
| 17 | |
| 18 | XRayInstrMask parseXRayInstrValue(StringRef Value) { |
Ian Levesque | 97ba483 | 2020-01-17 13:24:27 -0800 | [diff] [blame] | 19 | XRayInstrMask ParsedKind = |
| 20 | llvm::StringSwitch<XRayInstrMask>(Value) |
| 21 | .Case("all", XRayInstrKind::All) |
| 22 | .Case("custom", XRayInstrKind::Custom) |
| 23 | .Case("function", |
| 24 | XRayInstrKind::FunctionEntry | XRayInstrKind::FunctionExit) |
| 25 | .Case("function-entry", XRayInstrKind::FunctionEntry) |
| 26 | .Case("function-exit", XRayInstrKind::FunctionExit) |
| 27 | .Case("typed", XRayInstrKind::Typed) |
| 28 | .Case("none", XRayInstrKind::None) |
| 29 | .Default(XRayInstrKind::None); |
Dean Michael Berris | 488f7c2 | 2018-04-13 02:31:58 +0000 | [diff] [blame] | 30 | return ParsedKind; |
| 31 | } |
| 32 | |
| 33 | } // namespace clang |