[flang] Patches to permit building with Clang without notes or warnings.
authorpeter klausler <pklausler@nvidia.com>
Thu, 26 Apr 2018 22:44:29 +0000 (15:44 -0700)
committerpeter klausler <pklausler@nvidia.com>
Thu, 26 Apr 2018 22:44:29 +0000 (15:44 -0700)
Original-commit: flang-compiler/f18@0e74b10603ecceaca1781ecd0ee630de89e8e7f1
Reviewed-on: https://github.com/flang-compiler/f18/pull/73
Tree-same-pre-rewrite: false

flang/lib/parser/prescan.cc
flang/lib/parser/prescan.h
flang/lib/parser/unparse.cc
flang/lib/parser/unparse.h
flang/lib/semantics/make-types.h
flang/lib/semantics/pass1.cc
flang/lib/semantics/resolve-names.h
flang/lib/semantics/rewrite-parse-tree.h

index 5d95e99..1185895 100644 (file)
@@ -47,7 +47,6 @@ static void NormalizeCompilerDirectiveCommentMarker(TokenSequence *dir) {
 
 void Prescanner::Prescan(ProvenanceRange range) {
   AllSources &allSources{cooked_.allSources()};
-  ProvenanceRange around{allSources.GetContiguousRangeAround(range)};
   startProvenance_ = range.start();
   std::size_t offset{0};
   const SourceFile *source{allSources.GetSourceFile(startProvenance_, &offset)};
index 689429f..91682ab 100644 (file)
@@ -155,7 +155,6 @@ private:
   Messages &messages_;
   CookedSource &cooked_;
   Preprocessor &preprocessor_;
-  bool anyFatalErrors_{false};
   bool inFixedForm_{false};
   int fixedFormColumnLimit_{72};
   Encoding encoding_{Encoding::UTF8};
index 4fc58f7..76425e1 100644 (file)
@@ -29,23 +29,18 @@ public:
   template<typename T> void Before(const T &) {}
   template<typename T> double Unparse(const T &);  // not void, never used
 
-  template<typename T>
-  auto Pre(const T &x) ->
-      typename std::enable_if<std::is_void_v<decltype(Unparse(x))>,
-          bool>::type {
-    // There is a local definition of Unparse() for this type.  It
-    // overrides the parse tree walker's default Walk() over the descendents.
-    Before(x);
-    Unparse(x);
-    Post(x);
-    return false;  // Walk() does not visit descendents
-  }
-  template<typename T>
-  auto Pre(const T &x) ->
-      typename std::enable_if<!std::is_void_v<decltype(Unparse(x))>,
-          bool>::type {
-    Before(x);
-    return true;  // there's no Unparse() defined here, Walk() the descendents
+  template<typename T> bool Pre(const T &x) {
+    if constexpr (std::is_void_v<decltype(Unparse(x))>) {
+      // There is a local definition of Unparse() for this type.  It
+      // overrides the parse tree walker's default Walk() over the descendents.
+      Before(x);
+      Unparse(x);
+      Post(x);
+      return false;  // Walk() does not visit descendents
+    } else {
+      Before(x);
+      return true;  // there's no Unparse() defined here, Walk() the descendents
+    }
   }
   template<typename T> void Post(const T &) {}
 
index 699def3..00748b5 100644 (file)
@@ -7,7 +7,7 @@
 namespace Fortran {
 namespace parser {
 
-class Program;
+struct Program;
 
 /// Convert parsed program to out as Fortran.
 void Unparse(std::ostream &out, const Program &program,
index 7620811..f70a5c6 100644 (file)
@@ -1,7 +1,7 @@
 #include <iosfwd>
 
 namespace Fortran::parser {
-class Program;
+struct Program;
 class CookedSource;
 }  // namespace Fortran::parser
 
index afd486b..f0914cb 100644 (file)
@@ -1738,7 +1738,7 @@ public:
 
     // Specialize from StmtClass::LabelDo to StmtClass::NonLabelDoWhile or
     // StmtClass::NonLabelDoConcurrent where applicable
-    SpecializeDoStmt( sema.stmt_index , std::get<x.CONTROL>(x.t) ); 
+    SpecializeDoStmt( sema.stmt_index , std::get<std::optional<LoopControl>>(x.t) ); 
 
     return true ; 
   }
@@ -1774,7 +1774,7 @@ public:
 
     // Specialize from StmtClass::LabelDo to StmtClass::LabelDoWhile or
     // StmtClass::LabelDoConcurrent where applicable
-    SpecializeDoStmt( sema.stmt_index , std::get<x.CONTROL>(x.t) ); 
+    SpecializeDoStmt( sema.stmt_index , std::get<std::optional<LoopControl>>(x.t) ); 
 
     return true ; 
   }
index ed8e749..d132ad0 100644 (file)
@@ -1,7 +1,7 @@
 #include <iosfwd>
 
 namespace Fortran::parser {
-class Program;
+struct Program;
 class CookedSource;
 }  // namespace Fortran::parser
 
index ff2f990..33a82a9 100644 (file)
@@ -1,5 +1,5 @@
 namespace Fortran::parser {
-class Program;
+struct Program;
 }  // namespace Fortran::parser
 
 namespace Fortran::semantics {