diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2010-01-23 18:16:35 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2010-01-23 18:16:35 +0000 |
commit | c96f49417b2039d6227b042cd2d975f0869df79d (patch) | |
tree | 79d00a1d6eb7e9f3fa80d9117d6a7ad266d3ec9d /lib | |
parent | 1b627dc566f9f6fd7b8acfbb47fef4bedab688cf (diff) | |
download | clang-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.cpp | 11 |
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; |