================
@@ -172,6 +183,7 @@ class OriginManager {
   llvm::BumpPtrAllocator ListAllocator;
   llvm::DenseMap<const clang::ValueDecl *, OriginList *> DeclToList;
   llvm::DenseMap<const clang::Expr *, OriginList *> ExprToList;
+  const Decl *CurrentDecl;
----------------
usx95 wrote:

I don't see a use of having this as a field except `const auto *MD = 
dyn_cast<CXXMethodDecl>(CurrentDecl)`

I would suggest to instead have a `llvm::Optional<OriginList*> ThisOrigins`; 
and create this in the `OriginManager` ctor if `D` is a `CXXMethodDecl.`

You can then remove `OriginList *getOrCreateList(const CXXMethodDecl *MD);` and 
move parts of its docs to document `ThisOrigins`

Origins.cpp could do:

```cpp
 if (isa<CXXThisExpr>(E) && ThisOrigins)
   return *ThisOrigins;
```



https://github.com/llvm/llvm-project/pull/176703
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to