Author: Nikita Popov Date: 2022-04-05T11:28:40+02:00 New Revision: ff18b158edc4719c4b05cd04dceaedcf69a8d9c5
URL: https://github.com/llvm/llvm-project/commit/ff18b158edc4719c4b05cd04dceaedcf69a8d9c5 DIFF: https://github.com/llvm/llvm-project/commit/ff18b158edc4719c4b05cd04dceaedcf69a8d9c5.diff LOG: [CodeGen] Avoid unnecessary ConstantExpr cast With opaque pointers, this is not necessarily a ConstantExpr. And we don't need one here either, just Constant is sufficient. Added: Modified: clang/lib/CodeGen/CodeGenModule.cpp Removed: ################################################################################ diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index d637ab6ec288d..4d24c33f51d02 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -5407,7 +5407,7 @@ CodeGenModule::GetAddrOfConstantCFString(const StringLiteral *Literal) { auto Fields = Builder.beginStruct(STy); // Class pointer. - Fields.add(cast<llvm::ConstantExpr>(CFConstantStringClassRef)); + Fields.add(cast<llvm::Constant>(CFConstantStringClassRef)); // Flags. if (IsSwiftABI) { _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits