diff options
author | Jan Svoboda <jan_svoboda@apple.com> | 2025-04-28 12:42:03 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-28 12:42:03 -0700 |
commit | cebaf0cea1f2cf9d71b4d965104e08a7ff6c89c4 (patch) | |
tree | 51ae6ac08e4a15b27e8ddabb631fdf450687b75c /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | 882bae9f430e7d70246145839d41d95e40a7319a (diff) | |
download | llvm-cebaf0cea1f2cf9d71b4d965104e08a7ff6c89c4.zip llvm-cebaf0cea1f2cf9d71b4d965104e08a7ff6c89c4.tar.gz llvm-cebaf0cea1f2cf9d71b4d965104e08a7ff6c89c4.tar.bz2 |
[clang] Make the `AnalyzerOptions` reference count non-intrusive (#137680)
This PR makes `CompilerInvocation` the sole owner of the
`AnalyzerOptions` instance. Clients can no longer become co-owners by
doing something like this:
```c++
void shareOwnership(CompilerInvocation &CI) {
IntrusiveRefCntPtr Shared = &CI.getAnalyzerOpts();
}
```
The motivation for this is given here:
https://github.com/llvm/llvm-project/pull/133467#issuecomment-2762065443
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 1df5038..8ff62ae2 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -142,7 +142,7 @@ CompilerInvocationBase::CompilerInvocationBase() DiagnosticOpts(llvm::makeIntrusiveRefCnt<DiagnosticOptions>()), HSOpts(std::make_shared<HeaderSearchOptions>()), PPOpts(std::make_shared<PreprocessorOptions>()), - AnalyzerOpts(llvm::makeIntrusiveRefCnt<AnalyzerOptions>()), + AnalyzerOpts(std::make_shared<AnalyzerOptions>()), MigratorOpts(std::make_shared<MigratorOptions>()), APINotesOpts(std::make_shared<APINotesOptions>()), CodeGenOpts(std::make_shared<CodeGenOptions>()), @@ -159,7 +159,7 @@ CompilerInvocationBase::deep_copy_assign(const CompilerInvocationBase &X) { DiagnosticOpts = makeIntrusiveRefCntCopy(X.getDiagnosticOpts()); HSOpts = make_shared_copy(X.getHeaderSearchOpts()); PPOpts = make_shared_copy(X.getPreprocessorOpts()); - AnalyzerOpts = makeIntrusiveRefCntCopy(X.getAnalyzerOpts()); + AnalyzerOpts = make_shared_copy(X.getAnalyzerOpts()); MigratorOpts = make_shared_copy(X.getMigratorOpts()); APINotesOpts = make_shared_copy(X.getAPINotesOpts()); CodeGenOpts = make_shared_copy(X.getCodeGenOpts()); |