Revert "cros: add user-enumeration patch"
This reverts commit 06d4df1821d8c9f35e046809230ddc0cb1faaf87.
This enumeration patch has been in effect for 3 months now (well, ~1
month to start with, then it was accidentally reverted, and ~2 months
since). Seems reasonable to expect everyone who will respond to it has
done so.
BUG=b:457425658
TEST=None
Change-Id: I0ebf6ff7e671be3612e3a2e6c0d20cdd58f5c9c3
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index a767c34..912777a 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -80,7 +80,6 @@
#include "llvm/Option/OptTable.h"
#include "llvm/Option/Option.h"
#include "llvm/Support/CommandLine.h"
-#include "llvm/Support/ChromeOSUserEnum.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/ExitCodes.h"
#include "llvm/Support/FileSystem.h"
@@ -1426,14 +1425,6 @@
Compilation *Driver::BuildCompilation(ArrayRef<const char *> ArgList) {
llvm::PrettyStackTraceString CrashInfo("Compilation construction");
- if (chromeos_user_enum::shouldCheckForCmdlineFlag()) {
- StringRef AckFlag = "-D_CROSTC_IS_AWARE_OF_THIS_USECASE";
- bool HasAckFlag =
- llvm::any_of(ArgList, [&](const char *A) { return AckFlag == A; });
- if (!HasAckFlag)
- chromeos_user_enum::complainAboutNoAckAndDie(AckFlag);
- }
-
// FIXME: Handle environment options which affect driver behavior, somewhere
// (client?). GCC_EXEC_PREFIX, LPATH, CC_PRINT_OPTIONS.
diff --git a/llvm/include/llvm/Support/ChromeOSUserEnum.h b/llvm/include/llvm/Support/ChromeOSUserEnum.h
deleted file mode 100644
index c30a405..0000000
--- a/llvm/include/llvm/Support/ChromeOSUserEnum.h
+++ /dev/null
@@ -1,57 +0,0 @@
-#ifndef LLVM_SUPPORT_CHROMEOSUSERENUM_H
-#define LLVM_SUPPORT_CHROMEOSUSERENUM_H
-
-#include "llvm/ADT/StringRef.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string>
-
-// N.B., To minimize the chance of merge conflicts in cmake files, this is
-// header-only. The 'inline's below are written for linkage, not performance.
-namespace chromeos_user_enum {
-const char ACK_ENV_VAR[] = "CROSTC_IS_AWARE_OF_THIS_USECASE";
-
-inline bool isExecutingInPortableEnv() {
- // TODO: This may be too tricky?
- // This env var is set by shell scripts that invoke portable toolchain
- // binaries.
- return getenv("LD_ARGV0_REL") != nullptr;
-}
-
-inline bool shouldCheckForCmdlineFlag() {
- return isExecutingInPortableEnv() && getenv(ACK_ENV_VAR) == nullptr;
-}
-
-[[noreturn]] inline void complainAboutNoAckAndDie(llvm::StringRef flagToPass) {
- std::string s;
- s += "Hi!\n";
- s += "\n";
- s += "We (the CrOS toolchain team) are trying to identify\n";
- s += "users of this toolchain outside of ChromeOS.\n";
- s += "\n";
- s += "If your team/use-case isn't listed on b/396436337,\n";
- s += "please comment on that bug to notify us of your usage,\n";
- s += "and give us info on how to best contact you. If you\n";
- s += "can't access that bug, please instead email\n";
- s += "[email protected] with this information.\n";
- s += "\n";
- s += "After you've done this, you can fully bypass this\n";
- s += "message by setting the env var '";
- s += ACK_ENV_VAR;
- s += "=1'.\n";
- s += "\n";
- if (!flagToPass.empty()) {
- s += "Alternatively, you can pass the flag '";
- s += flagToPass.str();
- s += "' to\n";
- s += "this binary\n";
- s += "\n";
- }
- s += "Thanks for helping us determine who's using our tooling!\n";
- fprintf(stderr, s.c_str());
- exit(1);
-}
-} // namespace chromeos_user_enum
-
-#endif // LLVM_SUPPORT_CHROMEOSUSERENUM_H