diff options
author | Lang Hames <lhames@gmail.com> | 2011-12-05 20:16:26 +0000 |
---|---|---|
committer | Lang Hames <lhames@gmail.com> | 2011-12-05 20:16:26 +0000 |
commit | d42bb4778236c56bc73d2c4b113a42fde25f4b09 (patch) | |
tree | 60e949b5288b2883089536a5a1007f26b7c9becc /clang/lib/AST/ExprConstant.cpp | |
parent | 9e90c5cde37d0373b3b132bfbe27eb76222f52a3 (diff) | |
download | bcm5719-llvm-d42bb4778236c56bc73d2c4b113a42fde25f4b09.tar.gz bcm5719-llvm-d42bb4778236c56bc73d2c4b113a42fde25f4b09.zip |
Make isWeakDecl available as a method on ValueDecl.
llvm-svn: 145845
Diffstat (limited to 'clang/lib/AST/ExprConstant.cpp')
-rw-r--r-- | clang/lib/AST/ExprConstant.cpp | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index 81fe7e3a4e1..438bef5de87 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -580,15 +580,9 @@ static bool IsLiteralLValue(const LValue &Value) { return Value.Base.dyn_cast<const Expr*>() && !Value.Frame; } -static bool IsWeakDecl(const ValueDecl *Decl) { - return Decl->hasAttr<WeakAttr>() || - Decl->hasAttr<WeakRefAttr>() || - Decl->isWeakImported(); -} - static bool IsWeakLValue(const LValue &Value) { const ValueDecl *Decl = GetLValueBaseDecl(Value); - return Decl && IsWeakDecl(Decl); + return Decl && Decl->isWeak(); } static bool EvalPointerValueAsBool(const CCValue &Value, bool &Result) { @@ -607,7 +601,7 @@ static bool EvalPointerValueAsBool(const CCValue &Value, bool &Result) { // a weak declaration it can be null at runtime. Result = true; const ValueDecl *Decl = Value.getLValueBase().dyn_cast<const ValueDecl*>(); - return !Decl || !IsWeakDecl(Decl); + return !Decl || !Decl->isWeak(); } static bool HandleConversionToBool(const CCValue &Val, bool &Result) { @@ -866,7 +860,7 @@ static bool EvaluateVarDeclInit(EvalInfo &Info, const VarDecl *VD, // Never evaluate the initializer of a weak variable. We can't be sure that // this is the definition which will be used. - if (IsWeakDecl(VD)) + if (VD->isWeak()) return false; const Expr *Init = VD->getAnyInitializer(); |