[clangd] Fix the build with clang <3.9.
authorMichael Spencer <bigcheesegs@gmail.com>
Fri, 17 Jul 2020 22:12:18 +0000 (16:12 -0600)
committerMichael Spencer <bigcheesegs@gmail.com>
Fri, 17 Jul 2020 22:12:31 +0000 (16:12 -0600)
In clang <3.9 the `unique_ptr` constructor that is supposed to allow
for Derived to Base conversion does not work. Remove this if we drop
support for such configurations.

This is the same fix as in fda901a987ddd, and it updates the comments
to better reflect the actual issue. The same thing reproduces with
libc++ with older clangs.

clang-tools-extra/clangd/ConfigProvider.cpp
llvm/utils/TableGen/OptParserEmitter.cpp

index eec1ae9..a56cdd7 100644 (file)
@@ -209,7 +209,11 @@ Provider::combine(std::vector<const Provider *> Providers) {
   };
   auto Result = std::make_unique<CombinedProvider>();
   Result->Providers = std::move(Providers);
-  return Result;
+  // FIXME: This is a workaround for a bug in older versions of clang (< 3.9)
+  //   The constructor that is supposed to allow for Derived to Base
+  //   conversion does not work. Remove this if we drop support for such
+  //   configurations.
+  return std::unique_ptr<Provider>(Result.release());
 }
 
 Config Provider::getConfig(const Params &P, DiagnosticCallback DC) const {
index 34699b5..6e49e24 100644 (file)
@@ -110,10 +110,10 @@ public:
   static std::unique_ptr<MarshallingKindInfo> create(const Record &R) {
     std::unique_ptr<MarshallingFlagInfo> Ret(new MarshallingFlagInfo(R));
     Ret->IsPositive = R.getValueAsBit("IsPositive");
-    // FIXME: This is a workaround for a bug in older versions of libstdc++ when
-    //   compiled with Clang. The constructor that is supposed to allow for
-    //   Derived to Base conversion does not work. Remove this if we drop
-    //   support for such configurations.
+    // FIXME: This is a workaround for a bug in older versions of clang (< 3.9)
+    //   The constructor that is supposed to allow for Derived to Base
+    //   conversion does not work. Remove this if we drop support for such
+    //   configurations.
     return std::unique_ptr<MarshallingKindInfo>(Ret.release());
   }
 
@@ -208,10 +208,10 @@ struct SimpleEnumValueTable {
              "values");
     }
 
-    // FIXME: This is a workaround for a bug in older versions of libstdc++ when
-    //   compiled with Clang. The constructor that is supposed to allow for
-    //   Derived to Base conversion does not work. Remove this if we drop
-    //   support for such configurations.
+    // FIXME: This is a workaround for a bug in older versions of clang (< 3.9)
+    //   The constructor that is supposed to allow for Derived to Base
+    //   conversion does not work. Remove this if we drop support for such
+    //   configurations.
     return std::unique_ptr<MarshallingKindInfo>(Ret.release());
   }