head	1.1;
branch	1.1.1;
access;
symbols
	netbsd-11-0-RC6:1.1.1.2
	netbsd-11-0-RC5:1.1.1.2
	netbsd-11-0-RC4:1.1.1.2
	netbsd-11-0-RC3:1.1.1.2
	netbsd-11-0-RC2:1.1.1.2
	netbsd-11-0-RC1:1.1.1.2
	perseant-exfatfs-base-20250801:1.1.1.2
	netbsd-11:1.1.1.2.0.8
	netbsd-11-base:1.1.1.2
	netbsd-10-1-RELEASE:1.1.1.2
	perseant-exfatfs-base-20240630:1.1.1.2
	perseant-exfatfs:1.1.1.2.0.6
	perseant-exfatfs-base:1.1.1.2
	netbsd-10-0-RELEASE:1.1.1.2
	netbsd-10-0-RC6:1.1.1.2
	netbsd-10-0-RC5:1.1.1.2
	netbsd-10-0-RC4:1.1.1.2
	netbsd-10-0-RC3:1.1.1.2
	netbsd-10-0-RC2:1.1.1.2
	netbsd-10-0-RC1:1.1.1.2
	netbsd-10:1.1.1.2.0.4
	netbsd-10-base:1.1.1.2
	cjep_sun2x-base1:1.1.1.2
	cjep_sun2x:1.1.1.2.0.2
	cjep_sun2x-base:1.1.1.2
	cjep_staticlib_x-base1:1.1.1.2
	LLVM-249b40b558955afe5ac2b549edcf2d7f859c8cc9:1.1.1.2
	cjep_staticlib_x:1.1.1.1.0.4
	cjep_staticlib_x-base:1.1.1.1
	phil-wifi-20200421:1.1.1.1
	phil-wifi-20200411:1.1.1.1
	is-mlppp:1.1.1.1.0.2
	is-mlppp-base:1.1.1.1
	phil-wifi-20200406:1.1.1.1
	phil-wifi-20191119:1.1.1.1
	LLVM-01f3a59fb3e2542fce74c768718f594d0debd0da:1.1.1.1
	LLVM:1.1.1;
locks; strict;
comment	@// @;


1.1
date	2019.11.08.14.30.01;	author joerg;	state Exp;
branches
	1.1.1.1;
next	;
commitid	lIv69tfiG0KHw3KB;

1.1.1.1
date	2019.11.08.14.30.01;	author joerg;	state Exp;
branches
	1.1.1.1.4.1;
next	1.1.1.2;
commitid	lIv69tfiG0KHw3KB;

1.1.1.2
date	2021.05.30.01.25.35;	author joerg;	state Exp;
branches;
next	;
commitid	uhgdinROdC6tU6VC;

1.1.1.1.4.1
date	2021.05.31.22.07.12;	author cjep;	state Exp;
branches;
next	;
commitid	eWz9SBW0XqKjJlVC;


desc
@@


1.1
log
@Initial revision
@
text
@//===--- XRayInstr.cpp ------------------------------------------*- C++ -*-===//
//
// 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 is part of XRay, a function call instrumentation system.
//
//===----------------------------------------------------------------------===//

#include "clang/Basic/XRayInstr.h"
#include "llvm/ADT/StringSwitch.h"

namespace clang {

XRayInstrMask parseXRayInstrValue(StringRef Value) {
  XRayInstrMask ParsedKind = llvm::StringSwitch<XRayInstrMask>(Value)
                                 .Case("all", XRayInstrKind::All)
                                 .Case("custom", XRayInstrKind::Custom)
                                 .Case("function", XRayInstrKind::Function)
                                 .Case("typed", XRayInstrKind::Typed)
                                 .Case("none", XRayInstrKind::None)
                                 .Default(XRayInstrKind::None);
  return ParsedKind;
}

} // namespace clang
@


1.1.1.1
log
@Import 01f3a59fb3e2542fce74c768718f594d0debd0da from the LLVM mono-repo:
clang (without test/, unittests/, www/)
llvm (without test/, unittests/)
@
text
@@


1.1.1.1.4.1
log
@sync with head
@
text
@a13 1
#include "llvm/ADT/SmallVector.h"
d19 7
a25 11
  XRayInstrMask ParsedKind =
      llvm::StringSwitch<XRayInstrMask>(Value)
          .Case("all", XRayInstrKind::All)
          .Case("custom", XRayInstrKind::Custom)
          .Case("function",
                XRayInstrKind::FunctionEntry | XRayInstrKind::FunctionExit)
          .Case("function-entry", XRayInstrKind::FunctionEntry)
          .Case("function-exit", XRayInstrKind::FunctionExit)
          .Case("typed", XRayInstrKind::Typed)
          .Case("none", XRayInstrKind::None)
          .Default(XRayInstrKind::None);
a28 26
void serializeXRayInstrValue(XRayInstrSet Set,
                             SmallVectorImpl<StringRef> &Values) {
  if (Set.Mask == XRayInstrKind::All) {
    Values.push_back("all");
    return;
  }

  if (Set.Mask == XRayInstrKind::None) {
    Values.push_back("none");
    return;
  }

  if (Set.has(XRayInstrKind::Custom))
    Values.push_back("custom");

  if (Set.has(XRayInstrKind::Typed))
    Values.push_back("typed");

  if (Set.has(XRayInstrKind::FunctionEntry) &&
      Set.has(XRayInstrKind::FunctionExit))
    Values.push_back("function");
  else if (Set.has(XRayInstrKind::FunctionEntry))
    Values.push_back("function-entry");
  else if (Set.has(XRayInstrKind::FunctionExit))
    Values.push_back("function-exit");
}
@


1.1.1.2
log
@Import clang 249b40b558955afe5ac2b549edcf2d7f859c8cc9.
@
text
@a13 1
#include "llvm/ADT/SmallVector.h"
d19 7
a25 11
  XRayInstrMask ParsedKind =
      llvm::StringSwitch<XRayInstrMask>(Value)
          .Case("all", XRayInstrKind::All)
          .Case("custom", XRayInstrKind::Custom)
          .Case("function",
                XRayInstrKind::FunctionEntry | XRayInstrKind::FunctionExit)
          .Case("function-entry", XRayInstrKind::FunctionEntry)
          .Case("function-exit", XRayInstrKind::FunctionExit)
          .Case("typed", XRayInstrKind::Typed)
          .Case("none", XRayInstrKind::None)
          .Default(XRayInstrKind::None);
a28 26
void serializeXRayInstrValue(XRayInstrSet Set,
                             SmallVectorImpl<StringRef> &Values) {
  if (Set.Mask == XRayInstrKind::All) {
    Values.push_back("all");
    return;
  }

  if (Set.Mask == XRayInstrKind::None) {
    Values.push_back("none");
    return;
  }

  if (Set.has(XRayInstrKind::Custom))
    Values.push_back("custom");

  if (Set.has(XRayInstrKind::Typed))
    Values.push_back("typed");

  if (Set.has(XRayInstrKind::FunctionEntry) &&
      Set.has(XRayInstrKind::FunctionExit))
    Values.push_back("function");
  else if (Set.has(XRayInstrKind::FunctionEntry))
    Values.push_back("function-entry");
  else if (Set.has(XRayInstrKind::FunctionExit))
    Values.push_back("function-exit");
}
@

