[llvm] fda901a - [Clang] Fix building with Clang < 3.9.

Michael Spencer via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 17 12:33:53 PDT 2020


Author: Michael Spencer
Date: 2020-07-17T13:33:15-06:00
New Revision: fda901a987ddd7a59599c3dcaa6c9a18d959a9b3

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

LOG: [Clang] Fix building with Clang < 3.9.

This is a workaround for a bug in older versions of Clang when. The
constructor that is supposed to allow for Derived to Base conversion
does not work. Remove this if we drop support for such configurations.

Added: 
    

Modified: 
    llvm/utils/TableGen/OptParserEmitter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/utils/TableGen/OptParserEmitter.cpp b/llvm/utils/TableGen/OptParserEmitter.cpp
index 251533a8d154..34699b55e274 100644
--- a/llvm/utils/TableGen/OptParserEmitter.cpp
+++ b/llvm/utils/TableGen/OptParserEmitter.cpp
@@ -110,7 +110,11 @@ 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");
-    return Ret;
+    // 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.
+    return std::unique_ptr<MarshallingKindInfo>(Ret.release());
   }
 
 private:
@@ -204,7 +208,11 @@ struct SimpleEnumValueTable {
              "values");
     }
 
-    return Ret;
+    // 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.
+    return std::unique_ptr<MarshallingKindInfo>(Ret.release());
   }
 
 private:


        


More information about the llvm-commits mailing list