[clang] 311b291 - [Clang] Test that -dump-minimization-hints do not report unused decls. NFC

Ilya Biryukov via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 31 06:47:53 PDT 2025


Author: Ilya Biryukov
Date: 2025-07-31T15:47:19+02:00
New Revision: 311b2918129192b9171793406b0c53d9bdd9240b

URL: https://github.com/llvm/llvm-project/commit/311b2918129192b9171793406b0c53d9bdd9240b
DIFF: https://github.com/llvm/llvm-project/commit/311b2918129192b9171793406b0c53d9bdd9240b.diff

LOG: [Clang] Test that -dump-minimization-hints do not report unused decls. NFC

Added: 
    

Modified: 
    clang/test/Frontend/dump-minimization-hints.cpp

Removed: 
    


################################################################################
diff  --git a/clang/test/Frontend/dump-minimization-hints.cpp b/clang/test/Frontend/dump-minimization-hints.cpp
index 484378606da2b..273fd7f4ecd63 100644
--- a/clang/test/Frontend/dump-minimization-hints.cpp
+++ b/clang/test/Frontend/dump-minimization-hints.cpp
@@ -39,6 +39,26 @@
 // RANGE-NEXT:            "line": 15,
 // RANGE-NEXT:            "column": 2
 // RANGE-NEXT:          }
+// RANGE-NEXT:        },
+// RANGE-NEXT:        {
+// RANGE-NEXT:          "from": {
+// RANGE-NEXT:            "line": 19,
+// RANGE-NEXT:            "column": 1
+// RANGE-NEXT:          },
+// RANGE-NEXT:          "to": {
+// RANGE-NEXT:            "line": 19,
+// RANGE-NEXT:            "column": 41
+// RANGE-NEXT:          }
+// RANGE-NEXT:        },
+// RANGE-NEXT:        {
+// RANGE-NEXT:          "from": {
+// RANGE-NEXT:            "line": 20,
+// RANGE-NEXT:            "column": 1
+// RANGE-NEXT:          },
+// RANGE-NEXT:          "to": {
+// RANGE-NEXT:            "line": 23,
+// RANGE-NEXT:            "column": 2
+// RANGE-NEXT:          }
 // RANGE-NEXT:        }
 // RANGE-NEXT:      ]
 // RANGE-NEXT:    }
@@ -68,6 +88,16 @@ int multiply(int a, int b) {
     return a * b;
 }
 
+inline int unused_by_foo() {} // line 17
+
+inline void recursively_used_by_foo() {} // line 19
+inline int used_by_foo() { // line 20
+  recursively_used_by_foo();
+  return 1;
+}
+
+struct UnusedByFoo {};
+
 //--- foo.cpp
 #include "foo.h"
 int global_value = 5;
@@ -76,4 +106,6 @@ int main() {
   int current_value = data.getValue();
   int doubled_value = multiply(current_value, 2);
   int final_result = doubled_value + global_value;
+
+  return used_by_foo();
 }


        


More information about the cfe-commits mailing list