summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2010-01-23 18:16:35 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2010-01-23 18:16:35 +0000
commitc96f49417b2039d6227b042cd2d975f0869df79d (patch)
tree79d00a1d6eb7e9f3fa80d9117d6a7ad266d3ec9d /lib
parent1b627dc566f9f6fd7b8acfbb47fef4bedab688cf (diff)
downloadclang-c96f49417b2039d6227b042cd2d975f0869df79d.tar.gz
Simplify code with StringRef.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94314 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Sema/SemaDeclAttr.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp
index 1a12208e5a..f36afeb7e7 100644
--- a/lib/Sema/SemaDeclAttr.cpp
+++ b/lib/Sema/SemaDeclAttr.cpp
@@ -542,17 +542,16 @@ static void HandleVisibilityAttr(Decl *d, const AttributeList &Attr, Sema &S) {
return;
}
- const char *TypeStr = Str->getStrData();
- unsigned TypeLen = Str->getByteLength();
+ llvm::StringRef TypeStr = Str->getString();
VisibilityAttr::VisibilityTypes type;
- if (TypeLen == 7 && !memcmp(TypeStr, "default", 7))
+ if (TypeStr == "default")
type = VisibilityAttr::DefaultVisibility;
- else if (TypeLen == 6 && !memcmp(TypeStr, "hidden", 6))
+ else if (TypeStr == "hidden")
type = VisibilityAttr::HiddenVisibility;
- else if (TypeLen == 8 && !memcmp(TypeStr, "internal", 8))
+ else if (TypeStr == "internal")
type = VisibilityAttr::HiddenVisibility; // FIXME
- else if (TypeLen == 9 && !memcmp(TypeStr, "protected", 9))
+ else if (TypeStr == "protected")
type = VisibilityAttr::ProtectedVisibility;
else {
S.Diag(Attr.getLoc(), diag::warn_attribute_unknown_visibility) << TypeStr;