[all-commits] [llvm/llvm-project] 092601: [flang] Remove 'using namespace mlir; ` from header...

Andrzej WarzyƄski via All-commits all-commits at lists.llvm.org
Wed Mar 9 02:20:10 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 092601d4baab7c13c06b31eda2d5bed91d9a6b65
      https://github.com/llvm/llvm-project/commit/092601d4baab7c13c06b31eda2d5bed91d9a6b65
  Author: Andrzej Warzynski <andrzej.warzynski at arm.com>
  Date:   2022-03-09 (Wed, 09 Mar 2022)

  Changed paths:
    M flang/include/flang/Optimizer/Builder/Factory.h
    M flang/include/flang/Optimizer/Dialect/CanonicalizationPatterns.td
    M flang/include/flang/Optimizer/Dialect/FIROps.h
    M flang/include/flang/Optimizer/Dialect/FIROps.td
    M flang/include/flang/Optimizer/Dialect/FIROpsSupport.h
    M flang/lib/Lower/Bridge.cpp
    M flang/lib/Lower/CallInterface.cpp
    M flang/lib/Lower/IO.cpp
    M flang/lib/Lower/OpenACC.cpp
    M flang/lib/Lower/OpenMP.cpp
    M flang/lib/Optimizer/Builder/Character.cpp
    M flang/lib/Optimizer/Builder/DoLoopHelper.cpp
    M flang/lib/Optimizer/Builder/FIRBuilder.cpp
    M flang/lib/Optimizer/Builder/MutableBox.cpp
    M flang/lib/Optimizer/CodeGen/CGOps.h
    M flang/lib/Optimizer/CodeGen/CodeGen.cpp
    M flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp
    M flang/lib/Optimizer/CodeGen/TargetRewrite.cpp
    M flang/lib/Optimizer/Dialect/FIRDialect.cpp
    M flang/lib/Optimizer/Dialect/FIROps.cpp
    M flang/lib/Optimizer/Transforms/AffineDemotion.cpp
    M flang/lib/Optimizer/Transforms/AffinePromotion.cpp
    M flang/lib/Optimizer/Transforms/ArrayValueCopy.cpp
    M flang/lib/Optimizer/Transforms/ExternalNameConversion.cpp
    M flang/lib/Optimizer/Transforms/MemRefDataFlowOpt.cpp
    M flang/lib/Optimizer/Transforms/RewriteLoop.cpp
    M flang/unittests/Optimizer/Builder/DoLoopHelperTest.cpp
    M flang/unittests/Optimizer/Builder/FIRBuilderTest.cpp
    M flang/unittests/Optimizer/Builder/Runtime/CharacterTest.cpp
    M flang/unittests/Optimizer/Builder/Runtime/NumericTest.cpp
    M flang/unittests/Optimizer/Builder/Runtime/ReductionTest.cpp

  Log Message:
  -----------
  [flang] Remove 'using namespace mlir;` from header files

Currently, CGOps.h and FIROps.h contain `using namespace mlir;`. Every
file that includes one of these header files (directly and transitively)
will have the MLIR namespace enabled. With name-clashes within
sub-projects (LLVM and MLIR, MLIR and Flang), this is not desired. Also,
it is not possible to "un-use" a namespace once it is "used". Instead,
we should try to limit `using namespace` to implementation files (i.e.
*.cpp).

This patch removes `using namespace mlir;` from header files and adjusts
other files accordingly. In header and TableGen files, extra namespace
qualifier is added when referring to symbols defined in MLIR. Similar
approach is adopted in source files that didn't require many changes. In
files that would require a lot of changes, `using namespace mlir;` is
added instead.

Differential Revision: https://reviews.llvm.org/D120897




More information about the All-commits mailing list