[cfe-commits] r94314 - /cfe/trunk/lib/Sema/SemaDeclAttr.cpp
Benjamin Kramer
benny.kra at googlemail.com
Sat Jan 23 10:16:35 PST 2010
Author: d0k
Date: Sat Jan 23 12:16:35 2010
New Revision: 94314
URL: http://llvm.org/viewvc/llvm-project?rev=94314&view=rev
Log:
Simplify code with StringRef.
Modified:
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=94314&r1=94313&r2=94314&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Sat Jan 23 12:16:35 2010
@@ -542,17 +542,16 @@
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;
More information about the cfe-commits
mailing list