[PATCH 08/11] Do not use namespace polly inside a header.

Andreas Simbuerger simbuerg at googlemail.com
Sun Jun 8 17:42:30 PDT 2014


In general this fixes ambiguity that can arise from using
a different namespace that declares the same symbols as
we do.

One example inside llvm would be:
  createIndVarSimplifyPass(..);

Which can be found in:
  llvm/Transforms/Scalar.h
and
  polly/LinkAllPasses.h
---
 include/polly/LinkAllPasses.h  | 52 ++++++++++++++++++++----------------------
 lib/Support/RegisterPasses.cpp |  1 +
 2 files changed, 26 insertions(+), 27 deletions(-)

diff --git a/include/polly/LinkAllPasses.h b/include/polly/LinkAllPasses.h
index 6b2a019..edce2b0 100644
--- a/include/polly/LinkAllPasses.h
+++ b/include/polly/LinkAllPasses.h
@@ -63,8 +63,6 @@ extern char &IndependentBlocksID;
 extern char &CodePreparationID;
 }
 
-using namespace polly;
-
 namespace {
 struct PollyForcePassLinking {
   PollyForcePassLinking() {
@@ -76,36 +74,36 @@ struct PollyForcePassLinking {
       return;
 
 #ifdef CLOOG_FOUND
-    createCloogExporterPass();
-    createCloogInfoPass();
-    createCodeGenerationPass();
+    polly::createCloogExporterPass();
+    polly::createCloogInfoPass();
+    polly::createCodeGenerationPass();
 #endif
-    createCodePreparationPass();
-    createDeadCodeElimPass();
-    createDependencesPass();
-    createDOTOnlyPrinterPass();
-    createDOTOnlyViewerPass();
-    createDOTPrinterPass();
-    createDOTViewerPass();
-    createIndependentBlocksPass();
-    createIndVarSimplifyPass();
-    createJSONExporterPass();
-    createJSONImporterPass();
-    createScopDetectionPass();
-    createScopInfoPass();
+    polly::createCodePreparationPass();
+    polly::createDeadCodeElimPass();
+    polly::createDependencesPass();
+    polly::createDOTOnlyPrinterPass();
+    polly::createDOTOnlyViewerPass();
+    polly::createDOTPrinterPass();
+    polly::createDOTViewerPass();
+    polly::createIndependentBlocksPass();
+    polly::createIndVarSimplifyPass();
+    polly::createJSONExporterPass();
+    polly::createJSONImporterPass();
+    polly::createScopDetectionPass();
+    polly::createScopInfoPass();
 #ifdef PLUTO_FOUND
-    createPlutoOptimizerPass();
+    polly::createPlutoOptimizerPass();
 #endif
-    createPollyCanonicalizePass();
-    createIslAstInfoPass();
-    createIslCodeGenerationPass();
-    createIslScheduleOptimizerPass();
-    createTempScopInfoPass();
+    polly::createPollyCanonicalizePass();
+    polly::createIslAstInfoPass();
+    polly::createIslCodeGenerationPass();
+    polly::createIslScheduleOptimizerPass();
+    polly::createTempScopInfoPass();
 
 #ifdef SCOPLIB_FOUND
-    createPoccPass();
-    createScopLibExporterPass();
-    createScopLibImporterPass();
+    polly::createPoccPass();
+    polly::createScopLibExporterPass();
+    polly::createScopLibImporterPass();
 #endif
   }
 } PollyForcePassLinking; // Force link by creating a global definition.
diff --git a/lib/Support/RegisterPasses.cpp b/lib/Support/RegisterPasses.cpp
index 088585c..de2c530 100644
--- a/lib/Support/RegisterPasses.cpp
+++ b/lib/Support/RegisterPasses.cpp
@@ -37,6 +37,7 @@
 #include "llvm/Transforms/Vectorize.h"
 
 using namespace llvm;
+using namespace polly;
 
 cl::OptionCategory PollyCategory("Polly Optionsa",
                                  "Configure the polly loop optimizer");
-- 
2.0.0




More information about the llvm-commits mailing list