[clang] clang: __builtin_VARIABLE_NAME (PR #86756)

via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 26 19:12:29 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 1949f7d6c9bd59172c01c7933e1c558797c47eac dc4a313b793b4215c8a68bea0b4b8e70f8a7806b -- clang/test/CodeGenCXX/variable-name.cpp clang/include/clang/AST/Expr.h clang/lib/AST/Expr.cpp clang/lib/Parse/ParseExpr.cpp clang/lib/Sema/SemaExpr.cpp clang/test/SemaCXX/source_location.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/include/clang/AST/Expr.h b/clang/include/clang/AST/Expr.h
index 1d0e741ddc..d3e496b642 100644
--- a/clang/include/clang/AST/Expr.h
+++ b/clang/include/clang/AST/Expr.h
@@ -4731,7 +4731,8 @@ enum class SourceLocIdentKind {
 
 /// Represents a function call to one of __builtin_LINE(), __builtin_COLUMN(),
 /// __builtin_FUNCTION(), __builtin_FUNCSIG(), __builtin_FILE(),
-/// __builtin_FILE_NAME(), __builtin_source_location() or __builtin_VARIABLE_NAME().
+/// __builtin_FILE_NAME(), __builtin_source_location() or
+/// __builtin_VARIABLE_NAME().
 class SourceLocExpr final : public Expr {
   SourceLocation BuiltinLoc, RParenLoc;
   DeclContext *ParentContext;
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index 96954df5a9..1f03fe75e9 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -2332,7 +2332,7 @@ APValue SourceLocExpr::EvaluateInContext(const ASTContext &Ctx,
     if (isa<Decl>(Context)) {
       FindVarDecl FVD;
       FVD.ToFind = DefaultExpr;
-      FVD.TraverseDecl(const_cast<Decl*>(cast<Decl>(Context)));
+      FVD.TraverseDecl(const_cast<Decl *>(cast<Decl>(Context)));
       if (FVD.Found)
         return MakeStringLiteral(FVD.Found->getQualifiedNameAsString());
     }
diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp
index bca64d8540..a1a4c8fbe2 100644
--- a/clang/lib/Parse/ParseExpr.cpp
+++ b/clang/lib/Parse/ParseExpr.cpp
@@ -828,20 +828,18 @@ class CastExpressionIdValidator final : public CorrectionCandidateCallback {
 /// [OBJC]  '\@encode' '(' type-name ')'
 /// [OBJC]  objc-string-literal
 /// [C++]   simple-type-specifier '(' expression-list[opt] ')'      [C++ 5.2.3]
-/// [C++11] simple-type-specifier braced-init-list                  [C++11 5.2.3]
-/// [C++]   typename-specifier '(' expression-list[opt] ')'         [C++ 5.2.3]
-/// [C++11] typename-specifier braced-init-list                     [C++11 5.2.3]
-/// [C++]   'const_cast' '<' type-name '>' '(' expression ')'       [C++ 5.2p1]
-/// [C++]   'dynamic_cast' '<' type-name '>' '(' expression ')'     [C++ 5.2p1]
-/// [C++]   'reinterpret_cast' '<' type-name '>' '(' expression ')' [C++ 5.2p1]
-/// [C++]   'static_cast' '<' type-name '>' '(' expression ')'      [C++ 5.2p1]
-/// [C++]   'typeid' '(' expression ')'                             [C++ 5.2p1]
-/// [C++]   'typeid' '(' type-id ')'                                [C++ 5.2p1]
-/// [C++]   'this'          [C++ 9.3.2]
-/// [G++]   unary-type-trait '(' type-id ')'
-/// [G++]   binary-type-trait '(' type-id ',' type-id ')'           [TODO]
-/// [EMBT]  array-type-trait '(' type-id ',' integer ')'
-/// [clang] '^' block-literal
+/// [C++11] simple-type-specifier braced-init-list [C++11 5.2.3] [C++]
+/// typename-specifier '(' expression-list[opt] ')'         [C++ 5.2.3] [C++11]
+/// typename-specifier braced-init-list                     [C++11 5.2.3] [C++]
+/// 'const_cast' '<' type-name '>' '(' expression ')'       [C++ 5.2p1] [C++]
+/// 'dynamic_cast' '<' type-name '>' '(' expression ')'     [C++ 5.2p1] [C++]
+/// 'reinterpret_cast' '<' type-name '>' '(' expression ')' [C++ 5.2p1] [C++]
+/// 'static_cast' '<' type-name '>' '(' expression ')'      [C++ 5.2p1] [C++]
+/// 'typeid' '(' expression ')'                             [C++ 5.2p1] [C++]
+/// 'typeid' '(' type-id ')'                                [C++ 5.2p1] [C++]
+/// 'this'          [C++ 9.3.2] [G++]   unary-type-trait '(' type-id ')' [G++]
+/// binary-type-trait '(' type-id ',' type-id ')'           [TODO] [EMBT]
+/// array-type-trait '(' type-id ',' integer ')' [clang] '^' block-literal
 ///
 ///       constant: [C99 6.4.4]
 ///         integer-constant

``````````

</details>


https://github.com/llvm/llvm-project/pull/86756


More information about the cfe-commits mailing list