[PATCH] D52342: [XRay][clang] Propagate -fxray-instrumentation-bundle to -cc1

2018-09-21 Thread Dean Michael Berris via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC342715: [XRay][clang] Propagate 
-fxray-instrumentation-bundle to -cc1 (authored by dberris, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D52342?vs=166410=166412#toc

Repository:
  rC Clang

https://reviews.llvm.org/D52342

Files:
  include/clang/Basic/XRayInstr.h
  lib/Driver/XRayArgs.cpp
  test/Driver/XRay/xray-instrumentation-bundles-flags.cpp


Index: lib/Driver/XRayArgs.cpp
===
--- lib/Driver/XRayArgs.cpp
+++ lib/Driver/XRayArgs.cpp
@@ -215,4 +215,19 @@
 ModeOpt += Mode;
 CmdArgs.push_back(Args.MakeArgString(ModeOpt));
   }
+
+  SmallString<64> Bundle("-fxray-instrumentation-bundle=");
+  if (InstrumentationBundle.full()) {
+Bundle += "all";
+  } else if (InstrumentationBundle.empty()) {
+Bundle += "none";
+  } else {
+if (InstrumentationBundle.has(XRayInstrKind::Function))
+  Bundle += "function";
+if (InstrumentationBundle.has(XRayInstrKind::Custom))
+  Bundle += "custom";
+if (InstrumentationBundle.has(XRayInstrKind::Typed))
+  Bundle += "typed";
+  }
+  CmdArgs.push_back(Args.MakeArgString(Bundle));
 }
Index: include/clang/Basic/XRayInstr.h
===
--- include/clang/Basic/XRayInstr.h
+++ include/clang/Basic/XRayInstr.h
@@ -60,6 +60,8 @@
 
   bool empty() const { return Mask == 0; }
 
+  bool full() const { return Mask == XRayInstrKind::All; }
+
   XRayInstrMask Mask = 0;
 };
 
Index: test/Driver/XRay/xray-instrumentation-bundles-flags.cpp
===
--- test/Driver/XRay/xray-instrumentation-bundles-flags.cpp
+++ test/Driver/XRay/xray-instrumentation-bundles-flags.cpp
@@ -0,0 +1,11 @@
+// This test ensures that when we invoke the clang compiler, that the -cc1
+// options include the -fxray-instrumentation-bundle= flag we provide in the
+// invocation.
+//
+// RUN: %clang -fxray-instrument -fxray-instrumentation-bundle=function -### \
+// RUN: -x c++ -std=c++11 -emit-llvm -c -o - %s 2>&1 \
+// RUN: | FileCheck %s
+// CHECK:  -fxray-instrumentation-bundle=function
+//
+// REQUIRES-ANY: linux, freebsd
+// REQUIRES-ANY: amd64, x86_64, x86_64h, arm, aarch64, arm64


Index: lib/Driver/XRayArgs.cpp
===
--- lib/Driver/XRayArgs.cpp
+++ lib/Driver/XRayArgs.cpp
@@ -215,4 +215,19 @@
 ModeOpt += Mode;
 CmdArgs.push_back(Args.MakeArgString(ModeOpt));
   }
+
+  SmallString<64> Bundle("-fxray-instrumentation-bundle=");
+  if (InstrumentationBundle.full()) {
+Bundle += "all";
+  } else if (InstrumentationBundle.empty()) {
+Bundle += "none";
+  } else {
+if (InstrumentationBundle.has(XRayInstrKind::Function))
+  Bundle += "function";
+if (InstrumentationBundle.has(XRayInstrKind::Custom))
+  Bundle += "custom";
+if (InstrumentationBundle.has(XRayInstrKind::Typed))
+  Bundle += "typed";
+  }
+  CmdArgs.push_back(Args.MakeArgString(Bundle));
 }
Index: include/clang/Basic/XRayInstr.h
===
--- include/clang/Basic/XRayInstr.h
+++ include/clang/Basic/XRayInstr.h
@@ -60,6 +60,8 @@
 
   bool empty() const { return Mask == 0; }
 
+  bool full() const { return Mask == XRayInstrKind::All; }
+
   XRayInstrMask Mask = 0;
 };
 
Index: test/Driver/XRay/xray-instrumentation-bundles-flags.cpp
===
--- test/Driver/XRay/xray-instrumentation-bundles-flags.cpp
+++ test/Driver/XRay/xray-instrumentation-bundles-flags.cpp
@@ -0,0 +1,11 @@
+// This test ensures that when we invoke the clang compiler, that the -cc1
+// options include the -fxray-instrumentation-bundle= flag we provide in the
+// invocation.
+//
+// RUN: %clang -fxray-instrument -fxray-instrumentation-bundle=function -### \
+// RUN: -x c++ -std=c++11 -emit-llvm -c -o - %s 2>&1 \
+// RUN: | FileCheck %s
+// CHECK:  -fxray-instrumentation-bundle=function
+//
+// REQUIRES-ANY: linux, freebsd
+// REQUIRES-ANY: amd64, x86_64, x86_64h, arm, aarch64, arm64
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52342: [XRay][clang] Propagate -fxray-instrumentation-bundle to -cc1

2018-09-21 Thread Marcus Boerger via Phabricator via cfe-commits
mboerger accepted this revision.
mboerger added a comment.

LGTM


https://reviews.llvm.org/D52342



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52342: [XRay][clang] Propagate -fxray-instrumentation-bundle to -cc1

2018-09-21 Thread Dean Michael Berris via Phabricator via cfe-commits
dberris updated this revision to Diff 166410.
dberris added a comment.

Move the test to the driver, more appropriate location.


https://reviews.llvm.org/D52342

Files:
  clang/include/clang/Basic/XRayInstr.h
  clang/lib/Driver/XRayArgs.cpp
  clang/test/Driver/XRay/xray-instrumentation-bundles-flags.cpp


Index: clang/test/Driver/XRay/xray-instrumentation-bundles-flags.cpp
===
--- /dev/null
+++ clang/test/Driver/XRay/xray-instrumentation-bundles-flags.cpp
@@ -0,0 +1,11 @@
+// This test ensures that when we invoke the clang compiler, that the -cc1
+// options include the -fxray-instrumentation-bundle= flag we provide in the
+// invocation.
+//
+// RUN: %clang -fxray-instrument -fxray-instrumentation-bundle=function -### \
+// RUN: -x c++ -std=c++11 -emit-llvm -c -o - %s 2>&1 \
+// RUN: | FileCheck %s
+// CHECK:  -fxray-instrumentation-bundle=function
+//
+// REQUIRES-ANY: linux, freebsd
+// REQUIRES-ANY: amd64, x86_64, x86_64h, arm, aarch64, arm64
Index: clang/lib/Driver/XRayArgs.cpp
===
--- clang/lib/Driver/XRayArgs.cpp
+++ clang/lib/Driver/XRayArgs.cpp
@@ -215,4 +215,19 @@
 ModeOpt += Mode;
 CmdArgs.push_back(Args.MakeArgString(ModeOpt));
   }
+
+  SmallString<64> Bundle("-fxray-instrumentation-bundle=");
+  if (InstrumentationBundle.full()) {
+Bundle += "all";
+  } else if (InstrumentationBundle.empty()) {
+Bundle += "none";
+  } else {
+if (InstrumentationBundle.has(XRayInstrKind::Function))
+  Bundle += "function";
+if (InstrumentationBundle.has(XRayInstrKind::Custom))
+  Bundle += "custom";
+if (InstrumentationBundle.has(XRayInstrKind::Typed))
+  Bundle += "typed";
+  }
+  CmdArgs.push_back(Args.MakeArgString(Bundle));
 }
Index: clang/include/clang/Basic/XRayInstr.h
===
--- clang/include/clang/Basic/XRayInstr.h
+++ clang/include/clang/Basic/XRayInstr.h
@@ -60,6 +60,8 @@
 
   bool empty() const { return Mask == 0; }
 
+  bool full() const { return Mask == XRayInstrKind::All; }
+
   XRayInstrMask Mask = 0;
 };
 


Index: clang/test/Driver/XRay/xray-instrumentation-bundles-flags.cpp
===
--- /dev/null
+++ clang/test/Driver/XRay/xray-instrumentation-bundles-flags.cpp
@@ -0,0 +1,11 @@
+// This test ensures that when we invoke the clang compiler, that the -cc1
+// options include the -fxray-instrumentation-bundle= flag we provide in the
+// invocation.
+//
+// RUN: %clang -fxray-instrument -fxray-instrumentation-bundle=function -### \
+// RUN: -x c++ -std=c++11 -emit-llvm -c -o - %s 2>&1 \
+// RUN: | FileCheck %s
+// CHECK:  -fxray-instrumentation-bundle=function
+//
+// REQUIRES-ANY: linux, freebsd
+// REQUIRES-ANY: amd64, x86_64, x86_64h, arm, aarch64, arm64
Index: clang/lib/Driver/XRayArgs.cpp
===
--- clang/lib/Driver/XRayArgs.cpp
+++ clang/lib/Driver/XRayArgs.cpp
@@ -215,4 +215,19 @@
 ModeOpt += Mode;
 CmdArgs.push_back(Args.MakeArgString(ModeOpt));
   }
+
+  SmallString<64> Bundle("-fxray-instrumentation-bundle=");
+  if (InstrumentationBundle.full()) {
+Bundle += "all";
+  } else if (InstrumentationBundle.empty()) {
+Bundle += "none";
+  } else {
+if (InstrumentationBundle.has(XRayInstrKind::Function))
+  Bundle += "function";
+if (InstrumentationBundle.has(XRayInstrKind::Custom))
+  Bundle += "custom";
+if (InstrumentationBundle.has(XRayInstrKind::Typed))
+  Bundle += "typed";
+  }
+  CmdArgs.push_back(Args.MakeArgString(Bundle));
 }
Index: clang/include/clang/Basic/XRayInstr.h
===
--- clang/include/clang/Basic/XRayInstr.h
+++ clang/include/clang/Basic/XRayInstr.h
@@ -60,6 +60,8 @@
 
   bool empty() const { return Mask == 0; }
 
+  bool full() const { return Mask == XRayInstrKind::All; }
+
   XRayInstrMask Mask = 0;
 };
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52342: [XRay][clang] Propagate -fxray-instrumentation-bundle to -cc1

2018-09-21 Thread Marcus Boerger via Phabricator via cfe-commits
mboerger accepted this revision.
mboerger added a comment.
This revision is now accepted and ready to land.

LGTM


https://reviews.llvm.org/D52342



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D52342: [XRay][clang] Propagate -fxray-instrumentation-bundle to -cc1

2018-09-21 Thread Dean Michael Berris via Phabricator via cfe-commits
dberris created this revision.
dberris added reviewers: mboerger, tejohnson.

Add a test and ensure that we propagate the
-fxray-instrumentation-bundle flag from the driver invocation to the
-cc1 options.


https://reviews.llvm.org/D52342

Files:
  clang/include/clang/Basic/XRayInstr.h
  clang/lib/Driver/XRayArgs.cpp
  clang/test/CodeGen/xray-instrumentation-bundles-flags.cpp


Index: clang/test/CodeGen/xray-instrumentation-bundles-flags.cpp
===
--- /dev/null
+++ clang/test/CodeGen/xray-instrumentation-bundles-flags.cpp
@@ -0,0 +1,8 @@
+// This test ensures that when we invoke the clang compiler, that the -cc1
+// options include the -fxray-instrumentation-bundle= flag we provide in the
+// invocation.
+//
+// RUN: %clang -fxray-instrument -fxray-instrumentation-bundle=function -### \
+// RUN: -x c++ -std=c++11 -emit-llvm -c -o - %s 2>&1 \
+// RUN: | FileCheck %s
+// CHECK:  -fxray-instrumentation-bundle=function
Index: clang/lib/Driver/XRayArgs.cpp
===
--- clang/lib/Driver/XRayArgs.cpp
+++ clang/lib/Driver/XRayArgs.cpp
@@ -215,4 +215,19 @@
 ModeOpt += Mode;
 CmdArgs.push_back(Args.MakeArgString(ModeOpt));
   }
+
+  SmallString<64> Bundle("-fxray-instrumentation-bundle=");
+  if (InstrumentationBundle.full()) {
+Bundle += "all";
+  } else if (InstrumentationBundle.empty()) {
+Bundle += "none";
+  } else {
+if (InstrumentationBundle.has(XRayInstrKind::Function))
+  Bundle += "function";
+if (InstrumentationBundle.has(XRayInstrKind::Custom))
+  Bundle += "custom";
+if (InstrumentationBundle.has(XRayInstrKind::Typed))
+  Bundle += "typed";
+  }
+  CmdArgs.push_back(Args.MakeArgString(Bundle));
 }
Index: clang/include/clang/Basic/XRayInstr.h
===
--- clang/include/clang/Basic/XRayInstr.h
+++ clang/include/clang/Basic/XRayInstr.h
@@ -60,6 +60,8 @@
 
   bool empty() const { return Mask == 0; }
 
+  bool full() const { return Mask == XRayInstrKind::All; }
+
   XRayInstrMask Mask = 0;
 };
 


Index: clang/test/CodeGen/xray-instrumentation-bundles-flags.cpp
===
--- /dev/null
+++ clang/test/CodeGen/xray-instrumentation-bundles-flags.cpp
@@ -0,0 +1,8 @@
+// This test ensures that when we invoke the clang compiler, that the -cc1
+// options include the -fxray-instrumentation-bundle= flag we provide in the
+// invocation.
+//
+// RUN: %clang -fxray-instrument -fxray-instrumentation-bundle=function -### \
+// RUN: -x c++ -std=c++11 -emit-llvm -c -o - %s 2>&1 \
+// RUN: | FileCheck %s
+// CHECK:  -fxray-instrumentation-bundle=function
Index: clang/lib/Driver/XRayArgs.cpp
===
--- clang/lib/Driver/XRayArgs.cpp
+++ clang/lib/Driver/XRayArgs.cpp
@@ -215,4 +215,19 @@
 ModeOpt += Mode;
 CmdArgs.push_back(Args.MakeArgString(ModeOpt));
   }
+
+  SmallString<64> Bundle("-fxray-instrumentation-bundle=");
+  if (InstrumentationBundle.full()) {
+Bundle += "all";
+  } else if (InstrumentationBundle.empty()) {
+Bundle += "none";
+  } else {
+if (InstrumentationBundle.has(XRayInstrKind::Function))
+  Bundle += "function";
+if (InstrumentationBundle.has(XRayInstrKind::Custom))
+  Bundle += "custom";
+if (InstrumentationBundle.has(XRayInstrKind::Typed))
+  Bundle += "typed";
+  }
+  CmdArgs.push_back(Args.MakeArgString(Bundle));
 }
Index: clang/include/clang/Basic/XRayInstr.h
===
--- clang/include/clang/Basic/XRayInstr.h
+++ clang/include/clang/Basic/XRayInstr.h
@@ -60,6 +60,8 @@
 
   bool empty() const { return Mask == 0; }
 
+  bool full() const { return Mask == XRayInstrKind::All; }
+
   XRayInstrMask Mask = 0;
 };
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits