@@ -2305,6 +2308,36 @@ APValue SourceLocExpr::EvaluateInContext(const
ASTContext &Ctx,
};
switch (getIdentKind()) {
+ case SourceLocIdentKind::VariableName: {
+// __builtin_VARIABLE_NAME() is a Clang-specific extension that expands to
+// the name of the variable
jroelofs wrote:
Here's an example of the awkward lengths Halide has to go through to do this
without compiler support:
https://github.com/halide/Halide/blob/a132246ced07adc59c7b3631009464e5a14e0abb/src/Introspection.h#L19-L23
https://github.com/llvm/llvm-project/pull/86756
github-actions[bot] wrote:
:warning: C/C++ code formatter, clang-format found issues in your code.
:warning:
You can test this locally with the following command:
``bash
git-clang-format --diff 1949f7d6c9bd59172c01c7933e1c558797c47eac
dc4a313b793b4215c8a68bea0b4b8e70f8a7806b --
@@ -2305,6 +2308,36 @@ APValue SourceLocExpr::EvaluateInContext(const
ASTContext &Ctx,
};
switch (getIdentKind()) {
+ case SourceLocIdentKind::VariableName: {
+// __builtin_VARIABLE_NAME() is a Clang-specific extension that expands to
+// the name of the variable
https://github.com/jroelofs created
https://github.com/llvm/llvm-project/pull/86756
Some C++ Embedded DSLs make use of `std::source_location` as a form of crude
reflection. Until now, they didn't have a great way to reflect variable names
into their IRs. With `__buitlin_SOURCE_LOCATION()`, t