[clang] [Clang] enhance diagnostic by attaching source location to deduced type in trailing return without auto (PR #115786)

via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 12 04:11:08 PST 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 5dd9867e2d1e698fee980e31da114a37e4c7f612 0aa5ab4815abb8d6f45666d821738b244d3e7efa --extensions cpp -- clang/lib/Sema/SemaType.cpp clang/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p2-cxx0x.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp
index fd4bd1208d..a021e6e174 100644
--- a/clang/lib/Sema/SemaType.cpp
+++ b/clang/lib/Sema/SemaType.cpp
@@ -4887,9 +4887,10 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state,
                       cast<AutoType>(T)->getKeyword() !=
                           AutoTypeKeyword::Auto ||
                       cast<AutoType>(T)->isConstrained())) {
-            // Attach a valid source location for diagnostics on functions with trailing
-            // return types missing 'auto'. Attempt to get the location from the declared
-            // type; if invalid, fall back to the trailing return type's location.s
+            // Attach a valid source location for diagnostics on functions with
+            // trailing return types missing 'auto'. Attempt to get the location
+            // from the declared type; if invalid, fall back to the trailing
+            // return type's location.s
             SourceLocation Loc = D.getDeclSpec().getTypeSpecTypeLoc();
             SourceRange SR = D.getDeclSpec().getSourceRange();
             if (Loc.isInvalid()) {

``````````

</details>


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


More information about the cfe-commits mailing list