This avoids recomputing string lentgh that is already known at compile
time.
It has a slight impact on preprocessing / compile time, see
Paths
| Differential D139881
[clang] Use a StringRef instead of a raw char pointer to store builtin and call information ClosedPublic Authored by serge-sans-paille on Dec 12 2022, 1:47 PM.
Details
Summary This avoids recomputing string lentgh that is already known at compile It has a slight impact on preprocessing / compile time, see
Diff Detail Event TimelineHerald added projects: Restricted Project, Restricted Project, Restricted Project, Restricted Project. · View Herald TranscriptDec 12 2022, 1:47 PM Herald added subscribers: cfe-commits, llvm-commits, lldb-commits and 2 others. · View Herald Transcript
Comment Actions The StaticAnalyzer portion looks good to me AFAICT.
Comment Actions New version passes ninja check with clang, clang-tools-extra and lld.
Comment Actions Fix and simplify representation. The trick here is to use std::initializer_list to store array literals and pass them to the OptTable::Info constructor. As it's fine to have an empty initializer_list and there's already a constructor from initializer_liost to ArrayRef, this avoids most of the workarounds of previous patch. Also fix an implementation bug in clangd in previous implementation. This revision is now accepted and ready to land.Dec 22 2022, 7:51 AM Closed by commit rG719d98dfa841: [clang] Use a StringRef instead of a raw char pointer to store builtin and call… (authored by serge-sans-paille). · Explain WhyDec 23 2022, 2:24 AM This revision was automatically updated to reflect the committed changes. This revision is now accepted and ready to land.Dec 25 2022, 11:13 PM Closed by commit rGd9ab3e82f30d: [clang] Use a StringRef instead of a raw char pointer to store builtin and call… (authored by serge-sans-paille). · Explain WhyDec 27 2022, 12:55 AM This revision was automatically updated to reflect the committed changes. Herald added subscribers: kosarev, mattd, gchakrabarti and 31 others. · View Herald TranscriptDec 27 2022, 12:55 AM
Revision Contents
Diff 482825 clang-tools-extra/clangd/CompileCommands.cpp
clang/include/clang/Basic/Builtins.h
clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallDescription.h
clang/lib/AST/ExprConstant.cpp
clang/lib/Basic/Builtins.cpp
clang/lib/CodeGen/CGBuiltin.cpp
clang/lib/Driver/DriverOptions.cpp
clang/lib/Sema/SemaChecking.cpp
clang/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp
clang/lib/StaticAnalyzer/Checkers/BlockInCriticalSectionChecker.cpp
clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
clang/lib/StaticAnalyzer/Checkers/ChrootChecker.cpp
clang/lib/StaticAnalyzer/Checkers/ContainerModeling.cpp
clang/lib/StaticAnalyzer/Checkers/DebugContainerModeling.cpp
clang/lib/StaticAnalyzer/Checkers/DebugIteratorModeling.cpp
clang/lib/StaticAnalyzer/Checkers/ErrnoModeling.cpp
clang/lib/StaticAnalyzer/Checkers/ErrnoTesterChecker.cpp
clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
clang/lib/StaticAnalyzer/Checkers/MIGChecker.cpp
clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
clang/lib/StaticAnalyzer/Checkers/MmapWriteExecChecker.cpp
clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp
clang/lib/StaticAnalyzer/Checkers/SimpleStreamChecker.cpp
clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp
clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
clang/lib/StaticAnalyzer/Checkers/ValistChecker.cpp
clang/lib/StaticAnalyzer/Checkers/cert/InvalidPtrChecker.cpp
clang/lib/StaticAnalyzer/Checkers/cert/PutenvWithAutoChecker.cpp
clang/lib/StaticAnalyzer/Core/CallDescription.cpp
clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
clang/unittests/StaticAnalyzer/BugReportInterestingnessTest.cpp
clang/unittests/StaticAnalyzer/CallDescriptionTest.cpp
clang/unittests/StaticAnalyzer/ConflictingEvalCallsTest.cpp
clang/unittests/StaticAnalyzer/FalsePositiveRefutationBRVisitorTest.cpp
clang/unittests/StaticAnalyzer/NoStateChangeFuncVisitorTest.cpp
lld/COFF/DriverUtils.cpp
lld/ELF/DriverUtils.cpp
lld/MachO/DriverUtils.cpp
lld/MinGW/Driver.cpp
lld/wasm/Driver.cpp
lldb/tools/driver/Driver.cpp
lldb/tools/lldb-server/lldb-gdbserver.cpp
lldb/tools/lldb-vscode/lldb-vscode.cpp
llvm/include/llvm/ADT/ArrayRef.h
llvm/include/llvm/Option/OptTable.h
llvm/include/llvm/Option/Option.h
llvm/lib/ExecutionEngine/JITLink/COFFDirectiveParser.cpp
llvm/lib/Option/OptTable.cpp
llvm/lib/Option/Option.cpp
llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp
llvm/lib/ToolDrivers/llvm-lib/LibDriver.cpp
llvm/tools/dsymutil/dsymutil.cpp
llvm/tools/llvm-cvtres/llvm-cvtres.cpp
llvm/tools/llvm-cxxfilt/llvm-cxxfilt.cpp
llvm/tools/llvm-dwarfutil/llvm-dwarfutil.cpp
llvm/tools/llvm-ifs/llvm-ifs.cpp
llvm/tools/llvm-lipo/llvm-lipo.cpp
llvm/tools/llvm-ml/llvm-ml.cpp
llvm/tools/llvm-mt/llvm-mt.cpp
llvm/tools/llvm-nm/llvm-nm.cpp
llvm/tools/llvm-objcopy/ObjcopyOptions.cpp
llvm/tools/llvm-objdump/llvm-objdump.cpp
llvm/tools/llvm-rc/llvm-rc.cpp
llvm/tools/llvm-readobj/llvm-readobj.cpp
llvm/tools/llvm-size/llvm-size.cpp
llvm/tools/llvm-strings/llvm-strings.cpp
llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
llvm/tools/llvm-tli-checker/llvm-tli-checker.cpp
llvm/unittests/Option/OptionParsingTest.cpp
llvm/utils/TableGen/OptParserEmitter.cpp
|
this is still wrong semantically (and i believe are failing tests/builds, you can see it in the premerge bot builds for yourself https://buildkite.com/llvm-project/premerge-checks/builds/126513#018510e5-592b-453e-a213-a2cffc9c9ac2).
This was an array of pointers to null-terminated string blocks. Now you're turning it into just an array of strings.
IIUC, your intention is to change a list of strings terminated with a nullptr into an arrayref. so this should itself be an ArrayRef<StringLiteral>s.