diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2013-09-11 19:47:58 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2013-09-11 19:47:58 +0000 |
commit | 682ee42550a8e0a24693a075bd3431818e88ce13 (patch) | |
tree | dcc9c7f42168625d8618dca6a0184ed90a6a0b14 /clang/lib/Sema/SemaAttr.cpp | |
parent | 5b2f4b054054d4bd13bc0b39803ccd3e5e0618ec (diff) | |
download | bcm5719-llvm-682ee42550a8e0a24693a075bd3431818e88ce13.tar.gz bcm5719-llvm-682ee42550a8e0a24693a075bd3431818e88ce13.zip |
Tablegen now generates a StringSwitch for attributes containing enumeration arguments to map strings to the proper enumeration value. This makes error checking more consistent and reduces the amount of hand-written code required.
llvm-svn: 190545
Diffstat (limited to 'clang/lib/Sema/SemaAttr.cpp')
-rw-r--r-- | clang/lib/Sema/SemaAttr.cpp | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/clang/lib/Sema/SemaAttr.cpp b/clang/lib/Sema/SemaAttr.cpp index ebe294a70ca..8f9ab32517d 100644 --- a/clang/lib/Sema/SemaAttr.cpp +++ b/clang/lib/Sema/SemaAttr.cpp @@ -368,21 +368,12 @@ void Sema::ActOnPragmaVisibility(const IdentifierInfo* VisType, SourceLocation PragmaLoc) { if (VisType) { // Compute visibility to use. - VisibilityAttr::VisibilityType type; - if (VisType->isStr("default")) - type = VisibilityAttr::Default; - else if (VisType->isStr("hidden")) - type = VisibilityAttr::Hidden; - else if (VisType->isStr("internal")) - type = VisibilityAttr::Hidden; // FIXME - else if (VisType->isStr("protected")) - type = VisibilityAttr::Protected; - else { - Diag(PragmaLoc, diag::warn_attribute_unknown_visibility) << - VisType->getName(); + VisibilityAttr::VisibilityType T; + if (!VisibilityAttr::ConvertStrToVisibilityType(VisType->getName(), T)) { + Diag(PragmaLoc, diag::warn_attribute_unknown_visibility) << VisType; return; } - PushPragmaVisibility(*this, type, PragmaLoc); + PushPragmaVisibility(*this, T, PragmaLoc); } else { PopPragmaVisibility(false, PragmaLoc); } |