summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2011-10-06 04:19:35 +0000
committerTed Kremenek <kremenek@apple.com>2011-10-06 04:19:35 +0000
commit9504ae937049b69a4986270080244b5c7f085081 (patch)
treee2a2c8113c88bfd9f46bc31c21f9af05efe46492 /clang
parent485b80feccf1d908e82cfecac8f28330cf4f3507 (diff)
downloadbcm5719-llvm-9504ae937049b69a4986270080244b5c7f085081.tar.gz
bcm5719-llvm-9504ae937049b69a4986270080244b5c7f085081.zip
Hoist truncation checking for ParmVarDeclBitfields::ParameterIndex into its own helper method. No functionality change.
llvm-svn: 141272
Diffstat (limited to 'clang')
-rw-r--r--clang/include/clang/AST/Decl.h20
1 files changed, 13 insertions, 7 deletions
diff --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h
index a1d9bc5a4fa..8bc35a06977 100644
--- a/clang/include/clang/AST/Decl.h
+++ b/clang/include/clang/AST/Decl.h
@@ -728,6 +728,8 @@ private:
friend class StmtIteratorBase;
protected:
+ enum { NumParameterIndexBits = 8 };
+
class ParmVarDeclBitfields {
friend class ParmVarDecl;
friend class ASTDeclReader;
@@ -752,7 +754,7 @@ protected:
/// The number of parameters preceding this parameter in the
/// function parameter scope in which it was declared.
- unsigned ParameterIndex : 8;
+ unsigned ParameterIndex : NumParameterIndexBits;
};
union {
@@ -1218,12 +1220,10 @@ public:
Expr *DefArg);
virtual SourceRange getSourceRange() const;
-
+
void setObjCMethodScopeInfo(unsigned parameterIndex) {
ParmVarDeclBits.IsObjCMethodParam = true;
-
- ParmVarDeclBits.ParameterIndex = parameterIndex;
- assert(ParmVarDeclBits.ParameterIndex == parameterIndex && "truncation!");
+ setParameterIndex(parameterIndex);
}
void setScopeInfo(unsigned scopeDepth, unsigned parameterIndex) {
@@ -1232,8 +1232,7 @@ public:
ParmVarDeclBits.ScopeDepthOrObjCQuals = scopeDepth;
assert(ParmVarDeclBits.ScopeDepthOrObjCQuals == scopeDepth && "truncation!");
- ParmVarDeclBits.ParameterIndex = parameterIndex;
- assert(ParmVarDeclBits.ParameterIndex == parameterIndex && "truncation!");
+ setParameterIndex(parameterIndex);
}
bool isObjCMethodParameter() const {
@@ -1364,6 +1363,13 @@ public:
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
static bool classof(const ParmVarDecl *D) { return true; }
static bool classofKind(Kind K) { return K == ParmVar; }
+
+private:
+ void setParameterIndex(unsigned parameterIndex) {
+ ParmVarDeclBits.ParameterIndex = parameterIndex;
+ assert(ParmVarDeclBits.ParameterIndex == parameterIndex && "truncation!");
+ }
+
};
/// FunctionDecl - An instance of this class is created to represent a
OpenPOWER on IntegriCloud