-
Notifications
You must be signed in to change notification settings - Fork 15.4k
Slightly improve the getenv("bar") linking problem #150020
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
ldrumm marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| //===--- AlwaysTrue.h - Helper for oqaque truthy values --*- 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 | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_SUPPORT_ALWAYS_TRUE_H | ||
| #define LLVM_SUPPORT_ALWAYS_TRUE_H | ||
|
|
||
| #include <cstdlib> | ||
|
|
||
| namespace llvm { | ||
| inline bool getNonFoldableAlwaysTrue() { | ||
| // Some parts of the codebase require a "constant true value" used as a | ||
| // predicate. These cases require that even with LTO and static linking, | ||
| // it's not possible for the compiler to fold the value. As compilers | ||
| // aren't smart enough to know that getenv() never returns -1, this will do | ||
| // the job. | ||
| return std::getenv("LLVM_IGNORED_ENV_VAR") != (char *)-1; | ||
|
||
| } | ||
| } // end namespace llvm | ||
|
|
||
| #endif // LLVM_SUPPORT_ALWAYS_TRUE_H | ||
Uh oh!
There was an error while loading. Please reload this page.