XRayInstr.cpp 1.2 KB

1234567891011121314151617181920212223242526272829
  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. #include "clang/Basic/XRayInstr.h"
  13. #include "llvm/ADT/StringSwitch.h"
  14. namespace clang {
  15. XRayInstrMask parseXRayInstrValue(StringRef Value) {
  16. XRayInstrMask ParsedKind = llvm::StringSwitch<XRayInstrMask>(Value)
  17. .Case("all", XRayInstrKind::All)
  18. .Case("custom", XRayInstrKind::Custom)
  19. .Case("function", XRayInstrKind::Function)
  20. .Case("typed", XRayInstrKind::Typed)
  21. .Case("none", XRayInstrKind::None)
  22. .Default(XRayInstrKind::None);
  23. return ParsedKind;
  24. }
  25. } // namespace clang