summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/PCHWriterDecl.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-06-19 23:52:42 +0000
committerDouglas Gregor <dgregor@apple.com>2009-06-19 23:52:42 +0000
commitc9c02ed8f499f005b5a8e68f1ecd87401f90daa9 (patch)
tree003b2f568adda31fe1d7fe677e48f2ed126f4dc5 /clang/lib/Frontend/PCHWriterDecl.cpp
parent724f825f96ab44280a5864e67e8151a7792e393d (diff)
downloadbcm5719-llvm-c9c02ed8f499f005b5a8e68f1ecd87401f90daa9.tar.gz
bcm5719-llvm-c9c02ed8f499f005b5a8e68f1ecd87401f90daa9.zip
Keep track of when declarations are "used" according to C and
C++. This logic is required to trigger implicit instantiation of function templates and member functions of class templates, which will be implemented separately. This commit includes support for -Wunused-parameter, printing warnings for named parameters that are not used within a function/Objective-C method/block. Fixes <rdar://problem/6505209>. llvm-svn: 73797
Diffstat (limited to 'clang/lib/Frontend/PCHWriterDecl.cpp')
-rw-r--r--clang/lib/Frontend/PCHWriterDecl.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Frontend/PCHWriterDecl.cpp b/clang/lib/Frontend/PCHWriterDecl.cpp
index 55cff663c59..5173ce33125 100644
--- a/clang/lib/Frontend/PCHWriterDecl.cpp
+++ b/clang/lib/Frontend/PCHWriterDecl.cpp
@@ -82,6 +82,7 @@ void PCHDeclWriter::VisitDecl(Decl *D) {
Record.push_back(D->isInvalidDecl());
Record.push_back(D->hasAttrs());
Record.push_back(D->isImplicit());
+ Record.push_back(D->isUsed());
Record.push_back(D->getAccess());
}
@@ -360,6 +361,7 @@ void PCHDeclWriter::VisitParmVarDecl(ParmVarDecl *D) {
// know are true of all PARM_VAR_DECLs.
if (!D->hasAttrs() &&
!D->isImplicit() &&
+ !D->isUsed() &&
D->getAccess() == AS_none &&
D->getStorageClass() == 0 &&
!D->hasCXXDirectInitializer() && // Can params have this ever?
@@ -434,6 +436,7 @@ void PCHWriter::WriteDeclsBlockAbbrevs() {
Abv->Add(BitCodeAbbrevOp(0)); // isInvalidDecl (!?)
Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
Abv->Add(BitCodeAbbrevOp(0)); // isImplicit
+ Abv->Add(BitCodeAbbrevOp(0)); // isUsed
Abv->Add(BitCodeAbbrevOp(AS_none)); // C++ AccessSpecifier
// NamedDecl
OpenPOWER on IntegriCloud