diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-01-12 21:59:26 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-01-12 21:59:26 +0000 |
commit | ba3a4f917f2d99edabd2dd8045587379c48b5787 (patch) | |
tree | 13c21694c9bfee112842d04c83dfd64c87ed30a3 /clang/lib/Sema/SemaLookup.cpp | |
parent | c81c8c66d5046732a6b64a166b829ae12e787664 (diff) | |
download | bcm5719-llvm-ba3a4f917f2d99edabd2dd8045587379c48b5787.tar.gz bcm5719-llvm-ba3a4f917f2d99edabd2dd8045587379c48b5787.zip |
Improve AST dumping:
1) When dumping a declaration that declares a name for a type, also dump the named type.
2) Add a #pragma clang __debug dump X, that dumps the lookup results for X in
the current context.
llvm-svn: 257529
Diffstat (limited to 'clang/lib/Sema/SemaLookup.cpp')
-rw-r--r-- | clang/lib/Sema/SemaLookup.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp index 1d7b15c35d1..45dc2e33da9 100644 --- a/clang/lib/Sema/SemaLookup.cpp +++ b/clang/lib/Sema/SemaLookup.cpp @@ -650,6 +650,13 @@ void LookupResult::print(raw_ostream &Out) { } } +LLVM_DUMP_METHOD void LookupResult::dump() { + llvm::errs() << "lookup results for " << getLookupName().getAsString() + << ":\n"; + for (NamedDecl *D : *this) + D->dump(); +} + /// \brief Lookup a builtin function, when name lookup would otherwise /// fail. static bool LookupBuiltin(Sema &S, LookupResult &R) { @@ -4991,3 +4998,12 @@ const Sema::TypoExprState &Sema::getTypoExprState(TypoExpr *TE) const { void Sema::clearDelayedTypo(TypoExpr *TE) { DelayedTypos.erase(TE); } + +void Sema::ActOnPragmaDump(Scope *S, SourceLocation IILoc, IdentifierInfo *II) { + DeclarationNameInfo Name(II, IILoc); + LookupResult R(*this, Name, LookupAnyName, Sema::NotForRedeclaration); + R.suppressDiagnostics(); + R.setHideTags(false); + LookupName(R, S); + R.dump(); +} |