[flang] Address comments, clean up warnings
authorpeter klausler <pklausler@nvidia.com>
Tue, 2 Apr 2019 18:56:19 +0000 (11:56 -0700)
committerpeter klausler <pklausler@nvidia.com>
Tue, 2 Apr 2019 18:56:19 +0000 (11:56 -0700)
Original-commit: flang-compiler/f18@a5eeeb4430825020e14141c0d51d1bb7160546e5
Reviewed-on: https://github.com/flang-compiler/f18/pull/378

flang/lib/evaluate/formatting.cc
flang/lib/semantics/mod-file.cc
flang/lib/semantics/scope.cc
flang/lib/semantics/semantics.cc

index e5ebc2a..8b5cb8e 100644 (file)
@@ -207,20 +207,6 @@ template<TypeCategory CAT>
 static constexpr Precedence GetPrecedence(const Expr<SomeKind<CAT>> &expr) {
   return std::visit([](const auto &x) { return GetPrecedence(x); }, expr.u);
 }
-static constexpr Precedence GetPrecedence(const Expr<SomeDerived> &expr) {
-  return std::visit(
-      [](const auto &x) { return ToPrecedence<std::decay_t<decltype(x)>>; },
-      expr.u);
-}
-static constexpr Precedence GetPrecedence(const BOZLiteralConstant &) {
-  return Precedence::Primary;
-}
-static constexpr Precedence GetPrecedence(const NullPointer &) {
-  return Precedence::Primary;
-}
-static constexpr Precedence GetPrecedence(const Expr<SomeType> &expr) {
-  return std::visit([](const auto &x) { return GetPrecedence(x); }, expr.u);
-}
 
 template<typename T> static bool IsNegatedScalarConstant(const Expr<T> &expr) {
   static constexpr TypeCategory cat{T::category};
index 1cac339..d0c0500 100644 (file)
@@ -98,7 +98,6 @@ private:
       DoSymbol(*symbol);
     }
   }
-
 };
 
 bool ModFileWriter::WriteAll() {
@@ -391,7 +390,6 @@ std::vector<const Symbol *> CollectSymbols(const Scope &scope) {
   }
   for (const auto &pair : scope.commonBlocks()) {
     const Symbol *symbol{pair.second};
-    SourceName name{pair.first};
     if (symbols.insert(symbol).second) {
       common.push_back(symbol);
     }
index 2186dda..c4bc840 100644 (file)
@@ -186,8 +186,7 @@ bool Scope::CanImport(const SourceName &name) const {
 }
 
 const Scope *Scope::FindScope(parser::CharBlock source) const {
-  return const_cast<const Scope *>(
-      const_cast<Scope *>(this)->FindScope(source));
+  return const_cast<Scope *>(this)->FindScope(source);
 }
 
 Scope *Scope::FindScope(parser::CharBlock source) {
index 6efff1b..0c5ca15 100644 (file)
@@ -116,8 +116,7 @@ bool SemanticsContext::AnyFatalError() const {
 }
 
 const Scope &SemanticsContext::FindScope(parser::CharBlock source) const {
-  return const_cast<const Scope &>(
-      const_cast<SemanticsContext *>(this)->FindScope(source));
+  return const_cast<SemanticsContext *>(this)->FindScope(source);
 }
 
 Scope &SemanticsContext::FindScope(parser::CharBlock source) {