[cfe-dev] Question about Decl::isUsed()

Mikhail Ramalho via cfe-dev cfe-dev at lists.llvm.org
Tue Jul 3 10:13:55 PDT 2018

Hi everyone,

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.

Thank you,


Mikhail Ramalho.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180703/4b417da3/attachment.html>

More information about the cfe-dev mailing list