summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExprCXX.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-12-03 18:14:24 +0000
committerDouglas Gregor <dgregor@apple.com>2011-12-03 18:14:24 +0000
commitdca70af22f74c8a298def2b262f6f5fc277a34f0 (patch)
tree0921c956cf83a78fc79ef8cf3c3db13ef2a65293 /clang/lib/Sema/SemaExprCXX.cpp
parentdd5eb9df0cd248bc20fdca01f007f7119633a7d7 (diff)
downloadbcm5719-llvm-dca70af22f74c8a298def2b262f6f5fc277a34f0.tar.gz
bcm5719-llvm-dca70af22f74c8a298def2b262f6f5fc277a34f0.zip
Implement support for the __is_final type trait, to determine whether
a class is marked 'final', from Alberto Ganesh Barbati! Fixes PR11462. llvm-svn: 145775
Diffstat (limited to 'clang/lib/Sema/SemaExprCXX.cpp')
-rw-r--r--clang/lib/Sema/SemaExprCXX.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index 973e92d214e..06837fef847 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -2650,6 +2650,9 @@ static bool CheckUnaryTypeTraitTypeCompleteness(Sema &S,
case UTT_IsAbstract:
// Fall-through
+ // These traits require a complete type.
+ case UTT_IsFinal:
+
// These trait expressions are designed to help implement predicates in
// [meta.unary.prop] despite not being named the same. They are specified
// by both GCC and the Embarcadero C++ compiler, and require the complete
@@ -2775,6 +2778,10 @@ static bool EvaluateUnaryTypeTrait(Sema &Self, UnaryTypeTrait UTT,
if (const CXXRecordDecl *RD = T->getAsCXXRecordDecl())
return RD->isAbstract();
return false;
+ case UTT_IsFinal:
+ if (const CXXRecordDecl *RD = T->getAsCXXRecordDecl())
+ return RD->hasAttr<FinalAttr>();
+ return false;
case UTT_IsSigned:
return T->isSignedIntegerType();
case UTT_IsUnsigned:
OpenPOWER on IntegriCloud