[cfe-commits] r78019 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td include/clang/Parse/Action.h lib/Parse/ParsePragma.cpp lib/Sema/Sema.h lib/Sema/SemaAttr.cpp test/Sema/pragma-unused.c

Douglas Gregor dgregor at apple.com
Wed Aug 5 14:46:05 PDT 2009


On Aug 3, 2009, at 4:24 PM, Ted Kremenek wrote:

> Author: kremenek
> Date: Mon Aug  3 18:24:57 2009
> New Revision: 78019
>
> URL: http://llvm.org/viewvc/llvm-project?rev=78019&view=rev
> Log:
> Per advice that Doug Gregor gave me several months ago, clean up the
> implementation of '#pragma unused' by not constructing intermediate
> DeclRefExprs, but instead do the name lookup directly.  The
> implementation is greatly simplified.

I like this much better.

> +  for (unsigned i = 0; i < NumIdentifiers; ++i) {
> +    const Token &Tok = Identifiers[i];
> +    IdentifierInfo *Name = Tok.getIdentifierInfo();
> +    const LookupResult &Lookup = LookupParsedName(curScope, NULL,  
> Name,
> +                                                  LookupOrdinaryName,
> +                                                  false, true,
> +                                                  Tok.getLocation());
> +    // FIXME: Handle Lookup.isAmbiguous?

You could just use LookupName directly, since you're passing a NULL  
scope specifier anyway.

	- Doug



More information about the cfe-commits mailing list