[clang-tools-extra] 7fcc1bb - [clangd] Fix the build with clang <3.9.

Michael Spencer via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 17 15:14:19 PDT 2020


Author: Michael Spencer
Date: 2020-07-17T16:12:31-06:00
New Revision: 7fcc1bb4b654461c3109b01e1fe7eae191a86f7f

URL: https://github.com/llvm/llvm-project/commit/7fcc1bb4b654461c3109b01e1fe7eae191a86f7f
DIFF: https://github.com/llvm/llvm-project/commit/7fcc1bb4b654461c3109b01e1fe7eae191a86f7f.diff

LOG: [clangd] Fix the build with clang <3.9.

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.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/ConfigProvider.cpp b/clang-tools-extra/clangd/ConfigProvider.cpp
index eec1ae992194..a56cdd755322 100644
--- a/clang-tools-extra/clangd/ConfigProvider.cpp
+++ b/clang-tools-extra/clangd/ConfigProvider.cpp
@@ -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 {

diff  --git a/llvm/utils/TableGen/OptParserEmitter.cpp b/llvm/utils/TableGen/OptParserEmitter.cpp
index 34699b55e274..6e49e248e4b8 100644
--- a/llvm/utils/TableGen/OptParserEmitter.cpp
+++ b/llvm/utils/TableGen/OptParserEmitter.cpp
@@ -110,10 +110,10 @@ class MarshallingFlagInfo final : public MarshallingKindInfo {
   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());
   }
 


        


More information about the cfe-commits mailing list