[clang] clang: __builtin_VARIABLE_NAME (PR #86756)
Jon Roelofs via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 26 19:10:49 PDT 2024
================
@@ -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 being defined in a CXXDefaultArgExpr.
+
+ // FIXME: The AST doesn't have upward edges, so we can't easily traverse up
+ // from the CXXDefaultArgExpr to find it. Unfortunately, this means we need
+ // to do a linear scan of (up to) the entire FunctionDecl.
----------------
jroelofs wrote:
I could use some help here. Using the visitor to walk back up the AST feels wrong / slow.
https://github.com/llvm/llvm-project/pull/86756
More information about the cfe-commits
mailing list