[llvm] 991dc4b - Remove a top-level "using namespace" in TargetTransformInfoImpl.h

Pavel Labath via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 15 05:55:33 PDT 2022


Author: Pavel Labath
Date: 2022-03-15T13:49:20+01:00
New Revision: 991dc4b4e012ce8c7b631ae750ae6e070365c6db

URL: https://github.com/llvm/llvm-project/commit/991dc4b4e012ce8c7b631ae750ae6e070365c6db
DIFF: https://github.com/llvm/llvm-project/commit/991dc4b4e012ce8c7b631ae750ae6e070365c6db.diff

LOG: Remove a top-level "using namespace" in TargetTransformInfoImpl.h

Avoids polluting the namespace of all files including the header.

Added: 
    

Modified: 
    llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
    llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
index aebe61977bd71..45990266fb30e 100644
--- a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
+++ b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
@@ -24,8 +24,6 @@
 #include "llvm/IR/PatternMatch.h"
 #include <utility>
 
-using namespace llvm::PatternMatch;
-
 namespace llvm {
 
 class Function;
@@ -960,6 +958,8 @@ class TargetTransformInfoImplCRTPBase : public TargetTransformInfoImplBase {
 
   InstructionCost getUserCost(const User *U, ArrayRef<const Value *> Operands,
                               TTI::TargetCostKind CostKind) {
+    using namespace llvm::PatternMatch;
+
     auto *TargetTTI = static_cast<T *>(this);
     // Handle non-intrinsic calls, invokes, and callbr.
     // FIXME: Unlikely to be true for anything but CodeSize.

diff  --git a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
index b86e005ee090c..21e901d416f3d 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
@@ -57,6 +57,7 @@
 #include "llvm/Transforms/Vectorize.h"
 
 using namespace llvm;
+using namespace llvm::PatternMatch;
 
 namespace {
 class SGPRRegisterRegAlloc : public RegisterRegAllocBase<SGPRRegisterRegAlloc> {


        


More information about the llvm-commits mailing list