[cfe-dev] Question about Decl::isUsed()
cfe-dev at lists.llvm.org
Tue Jul 3 10:22:40 PDT 2018
You might want to read through https://reviews.llvm.org/D46190 which has some remarks from Richard Smith (Clang code owner) about Used versus Referenced.
Also might point out how these tracking flags might not be perfectly handled in things that don't turn into object-file entities, such as typedefs.
From: cfe-dev [mailto:cfe-dev-bounces at lists.llvm.org] On Behalf Of Mikhail Ramalho via cfe-dev
Sent: Tuesday, July 03, 2018 1:14 PM
To: Mikhail Ramalho via cfe-dev
Subject: [cfe-dev] Question about Decl::isUsed()
I'm trying to write a tool to remove unused declarations from preprocessed files but found an odd behaviour when using the Decl::isUsed() call.
It works great with clang::FunctionDecl and clang::ValueDecl, but when I try to check the flag for clang::TagDecl or clang::TypedefNameDecl, it's always false, even if it's used in the preprocessed file.
Is that the expected behaviour? I know that there might be problems when dealing with cross TUs but I have a single preprocessed file and everything is marked as unused.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-dev