[flang] Remove support for Names in messages for now.
authorpeter klausler <pklausler@nvidia.com>
Tue, 7 May 2019 17:04:21 +0000 (10:04 -0700)
committerpeter klausler <pklausler@nvidia.com>
Tue, 7 May 2019 17:04:21 +0000 (10:04 -0700)
Original-commit: flang-compiler/f18@15d38c7059352cb4d6d8df28a35cbde3b0fe92c5
Reviewed-on: https://github.com/flang-compiler/f18/pull/444

flang/lib/evaluate/type.h
flang/lib/parser/message.cc
flang/lib/parser/message.h
flang/lib/semantics/check-io.cc
flang/lib/semantics/rewrite-parse-tree.cc

index b62a9f29574ec2c5d1aaf9315b4606cf1865208f..33a1cc5fac41aeec03e06879524e0f1539364c7b 100644 (file)
@@ -163,7 +163,6 @@ private:
   constexpr DynamicType() {}
 };
 
-
 template<TypeCategory CATEGORY, int KIND = 0> struct TypeBase {
   static constexpr TypeCategory category{CATEGORY};
   static constexpr int kind{KIND};
index 3fdb3a746cc6ecb787248cf79d401b1eadef1a25..117fbc21481317ed397e057c2737db6573c4a7db 100644 (file)
@@ -14,7 +14,6 @@
 
 #include "message.h"
 #include "char-set.h"
-#include "parse-tree.h"
 #include "../common/idioms.h"
 #include <algorithm>
 #include <cstdarg>
@@ -86,16 +85,6 @@ const char *MessageFormattedText::Convert(CharBlock &&x) {
   return Convert(x.ToString());
 }
 
-const char *MessageFormattedText::Convert(const Name &n) {
-  return Convert(n.source);
-}
-
-const char *MessageFormattedText::Convert(Name &n) { return Convert(n.source); }
-
-const char *MessageFormattedText::Convert(Name &&n) {
-  return Convert(n.source);
-}
-
 std::string MessageExpectedText::ToString() const {
   return std::visit(
       common::visitors{
index 353257030d414f5ebe07851a8a4fc1724b9a50e3..3503ee0952ae91aebe0bff2858a169aa4a4220fb 100644 (file)
@@ -35,8 +35,6 @@
 
 namespace Fortran::parser {
 
-struct Name;
-
 // Use "..."_err_en_US and "..."_en_US literals to define the static
 // text and fatality of a message.
 class MessageFixedText {
@@ -70,9 +68,9 @@ constexpr MessageFixedText operator""_err_en_US(
 
 // The construction of a MessageFormattedText uses a MessageFixedText
 // as a vsnprintf() formatting string that is applied to the
-// following arguments.  CharBlock and std::string argument values are
-// also supported; they are automatically converted into char pointers
-// that are suitable for '%s' formatting.
+// following arguments.  CharBlock and std::string argument
+// values are also supported; they are automatically converted into
+// char pointers that are suitable for '%s' formatting.
 class MessageFormattedText {
 public:
   template<typename... A>
@@ -90,8 +88,17 @@ public:
 
 private:
   void Format(const MessageFixedText *text, ...);
-  template<typename A> A Convert(A &x) { return x; }
+
+  template<typename A> A Convert(const A &x) {
+    static_assert(!std::is_class_v<std::decay_t<A>>);
+    return x;
+  }
+  template<typename A> A Convert(A &x) {
+    static_assert(!std::is_class_v<std::decay_t<A>>);
+    return x;
+  }
   template<typename A> common::IfNoLvalue<A, A> Convert(A &&x) {
+    static_assert(!std::is_class_v<std::decay_t<A>>);
     return std::move(x);
   }
   const char *Convert(const std::string &);
@@ -100,9 +107,6 @@ private:
   const char *Convert(const CharBlock &);
   const char *Convert(CharBlock &);
   const char *Convert(CharBlock &&);
-  const char *Convert(const Name &);
-  const char *Convert(Name &);
-  const char *Convert(Name &&);
 
   bool isFatal_{false};
   std::string string_;
index 35782ae0d5d3509e301a35174883495fe0b37c09..74a9800eea1fd61afd47b2d5b3e2cc7752617780 100644 (file)
@@ -139,7 +139,7 @@ void IoChecker::Enter(const parser::InputItem &spec) {
         // This check may be superseded by C928 or C1002.
         context_.Say(name.source,
             "'%s' must not be a whole assumed size array"_err_en_US,
-            name);  // C1231
+            name.source);  // C1231
       }
     }
   }
index cc9e42595b5df0f1d2df0c9db1eff034dc651e5b..832ea2061108a77cdfe473bd88e3f100db6e6aee 100644 (file)
@@ -75,8 +75,8 @@ private:
 // Check that name has been resolved to a symbol
 void RewriteMutator::Post(parser::Name &name) {
   if (name.symbol == nullptr && errorOnUnresolvedName_) {
-    messages_.Say(
-        name.source, "Internal: no symbol found for '%s'"_err_en_US, name);
+    messages_.Say(name.source, "Internal: no symbol found for '%s'"_err_en_US,
+        name.source);
   }
 }