[llvm] [Support] Don't bring PatternMatchHelpers into top-level scope. NFC (PR #213016)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 30 05:53:28 PDT 2026


https://github.com/lukel97 created https://github.com/llvm/llvm-project/pull/213016

Otherwise every file that includes any of the PatternMatch.h headers ends up inadvertently bringing it into scope.


>From 94526f31a70f49646530116fe8667e62cfa78968 Mon Sep 17 00:00:00 2001
From: Luke Lau <luke at igalia.com>
Date: Thu, 30 Jul 2026 20:51:24 +0800
Subject: [PATCH] [Support] Don't bring PatternMatchHelpers into top-level
 scope. NFC

Otherwise every file that includes any of the PatternMatch.h headers ends up inadvertently bringing it into scope.
---
 llvm/include/llvm/Analysis/ScalarEvolutionPatternMatch.h | 4 ++--
 llvm/include/llvm/IR/PatternMatch.h                      | 4 ++--
 llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h        | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/llvm/include/llvm/Analysis/ScalarEvolutionPatternMatch.h b/llvm/include/llvm/Analysis/ScalarEvolutionPatternMatch.h
index aeeb88d722cf0..b6820fbd8075b 100644
--- a/llvm/include/llvm/Analysis/ScalarEvolutionPatternMatch.h
+++ b/llvm/include/llvm/Analysis/ScalarEvolutionPatternMatch.h
@@ -17,8 +17,6 @@
 #include "llvm/Analysis/ScalarEvolutionExpressions.h"
 #include "llvm/Support/PatternMatchHelpers.h"
 
-using namespace llvm::PatternMatchHelpers;
-
 namespace llvm {
 namespace PatternMatchHelpers {
 template <typename SCEVPtrT> struct match_bind<SCEVUseT<SCEVPtrT>> {
@@ -35,6 +33,8 @@ template <typename SCEVPtrT> struct match_bind<SCEVUseT<SCEVPtrT>> {
 
 namespace SCEVPatternMatch {
 
+using namespace llvm::PatternMatchHelpers;
+
 template <typename Pattern> bool match(const SCEV *S, const Pattern &P) {
   return P.match(S);
 }
diff --git a/llvm/include/llvm/IR/PatternMatch.h b/llvm/include/llvm/IR/PatternMatch.h
index ca1dd7b46a6c4..70b9a72768ec7 100644
--- a/llvm/include/llvm/IR/PatternMatch.h
+++ b/llvm/include/llvm/IR/PatternMatch.h
@@ -46,11 +46,11 @@
 #include <cstdint>
 #include <utility>
 
-using namespace llvm::PatternMatchHelpers;
-
 namespace llvm {
 namespace PatternMatch {
 
+using namespace llvm::PatternMatchHelpers;
+
 template <typename Val, typename Pattern> bool match(Val *V, const Pattern &P) {
   return P.match(V);
 }
diff --git a/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h b/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h
index 7e7d0f9b6a280..cf6d5e1408fc6 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h
+++ b/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h
@@ -20,10 +20,10 @@
 #include "llvm/Support/PatternMatchHelpers.h"
 #include <utility>
 
-using namespace llvm::PatternMatchHelpers;
-
 namespace llvm::VPlanPatternMatch {
 
+using namespace llvm::PatternMatchHelpers;
+
 template <typename Val, typename Pattern> bool match(Val *V, const Pattern &P) {
   return P.match(V);
 }



More information about the llvm-commits mailing list