[all-commits] [llvm/llvm-project] 1def25: PR51018: Remove explicit conversions from SmallStr...
David Blaikie via All-commits
all-commits at lists.llvm.org
Thu Jul 8 13:38:41 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 1def2579e10dd84405465f403e8c31acebff0c97
https://github.com/llvm/llvm-project/commit/1def2579e10dd84405465f403e8c31acebff0c97
Author: David Blaikie <dblaikie at gmail.com>
Date: 2021-07-08 (Thu, 08 Jul 2021)
Changed paths:
M clang-tools-extra/clang-doc/HTMLGenerator.cpp
M clang-tools-extra/clangd/JSONTransport.cpp
M clang-tools-extra/clangd/QueryDriverDatabase.cpp
M clang-tools-extra/clangd/Selection.cpp
M clang/include/clang/Tooling/DependencyScanning/DependencyScanningFilesystem.h
M clang/lib/AST/MicrosoftMangle.cpp
M clang/lib/Analysis/MacroExpansionContext.cpp
M clang/lib/Basic/FileManager.cpp
M clang/lib/CodeGen/MicrosoftCXXABI.cpp
M clang/lib/CrossTU/CrossTranslationUnit.cpp
M clang/lib/Driver/ToolChains/AMDGPU.cpp
M clang/lib/Lex/HeaderSearch.cpp
M clang/lib/Lex/PPDirectives.cpp
M clang/lib/Sema/SemaStmt.cpp
M clang/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp
M clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp
M clang/tools/clang-scan-deps/ClangScanDeps.cpp
M clang/unittests/Frontend/FrontendActionTest.cpp
M lld/COFF/PDB.cpp
M lldb/source/Commands/CommandCompletions.cpp
M llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
M llvm/lib/IR/ValueSymbolTable.cpp
M llvm/lib/LTO/LTOModule.cpp
M llvm/lib/MC/MCContext.cpp
M llvm/lib/Object/IRSymtab.cpp
M llvm/lib/ProfileData/Coverage/CoverageMappingWriter.cpp
M llvm/lib/Support/CommandLine.cpp
M llvm/lib/Support/Signals.cpp
M llvm/lib/Support/VirtualFileSystem.cpp
M llvm/lib/Transforms/Scalar/MergeICmps.cpp
M llvm/lib/Transforms/Utils/MemoryOpRemark.cpp
M llvm/tools/llvm-exegesis/lib/Analysis.cpp
M llvm/tools/llvm-readobj/COFFDumper.cpp
M llvm/unittests/Bitstream/BitstreamWriterTest.cpp
M llvm/unittests/DebugInfo/DWARF/DWARFDieManualExtractTest.cpp
M llvm/unittests/Support/CommandLineTest.cpp
M llvm/unittests/Support/LockFileManagerTest.cpp
M mlir/lib/IR/AsmPrinter.cpp
M mlir/lib/Tools/mlir-lsp-server/lsp/Transport.cpp
Log Message:
-----------
PR51018: Remove explicit conversions from SmallString to StringRef to future-proof against C++23
C++23 will make these conversions ambiguous - so fix them to make the
codebase forward-compatible with C++23 (& a follow-up change I've made
will make this ambiguous/invalid even in <C++23 so we don't regress
this & it generally improves the code anyway)
Commit: e2d30846327c7ec5cc9d2a46aa9bcd9c2c4eff93
https://github.com/llvm/llvm-project/commit/e2d30846327c7ec5cc9d2a46aa9bcd9c2c4eff93
Author: David Blaikie <dblaikie at gmail.com>
Date: 2021-07-08 (Thu, 08 Jul 2021)
Changed paths:
M llvm/include/llvm/ADT/SmallString.h
Log Message:
-----------
PR51018: Disallow explicit construction of StringRef from SmallString due to ambiguity in C++23
See bug for full details, but basically there's an upcoming ambiguity in
the conversion in `StringRef(SomeSmallString)` - either the implicit
conversion operator (SmallString::operator StringRef) could be used, or
the std::string_view range-based ctor (& then `StringRef(std::string_view)`
would be used)
To address this, make such a conversion invalid up-front - most uses are
more tersely written as `SomeSmallString.str()` anyway, or more clearly
written as `StringRef x = y;` rather than `StringRef x(y);` - so if you
hit this in out-of-tree code, please update in one of those ways.
Hopefully I've fixed everything in tree prior to this patch landing.
Compare: https://github.com/llvm/llvm-project/compare/a7992b43a54f...e2d30846327c
More information about the All-commits
mailing list