diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-04-14 06:00:08 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-04-14 06:00:08 +0000 |
commit | 04d4078425614bf9fd58d606335c1f5f74ee7fa4 (patch) | |
tree | 50baa3264e6c2b836c5a99fc45b70a0c74923f82 /tools | |
parent | 9f9427999cf69b3b89cd0ed3be16ed27a1c282c7 (diff) |
Clean up handling of visibility.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69027 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r-- | tools/clang-cc/clang-cc.cpp | 37 |
1 files changed, 12 insertions, 25 deletions
diff --git a/tools/clang-cc/clang-cc.cpp b/tools/clang-cc/clang-cc.cpp index 31515a9c12..91b87f2b05 100644 --- a/tools/clang-cc/clang-cc.cpp +++ b/tools/clang-cc/clang-cc.cpp @@ -812,36 +812,23 @@ void InitializeGCMode(LangOptions &Options) { Options.setGCMode(LangOptions::HybridGC); } -static llvm::cl::opt<std::string> +static llvm::cl::opt<LangOptions::VisibilityMode> SymbolVisibility("fvisibility", - llvm::cl::desc("Set the default visibility to the specific option")); - -void InitializeSymbolVisibility(LangOptions &Options) { - if (SymbolVisibility.empty()) - return; - std::string Visibility = SymbolVisibility; - const char *vkind = Visibility.c_str(); - if (!strcmp(vkind, "default")) - Options.setVisibilityMode(LangOptions::DefaultVisibility); - else if (!strcmp(vkind, "protected")) - Options.setVisibilityMode(LangOptions::ProtectedVisibility); - else if (!strcmp(vkind, "hidden")) - Options.setVisibilityMode(LangOptions::HiddenVisibility); - else if (!strcmp(vkind, "internal")) - Options.setVisibilityMode(LangOptions::InternalVisibility); - else - fprintf(stderr, - "-fvisibility only valid for default|protected|hidden|internal\n"); -} + llvm::cl::desc("Set the default symbol visibility:"), + llvm::cl::init(LangOptions::Default), + llvm::cl::values(clEnumValN(LangOptions::Default, "default", + "Use default symbol visibility"), + clEnumValN(LangOptions::Hidden, "hidden", + "Use hidden symbol visibility"), + clEnumValN(LangOptions::Protected,"protected", + "Use protected symbol visibility"), + clEnumValEnd)); static llvm::cl::opt<bool> OverflowChecking("ftrapv", llvm::cl::desc("Trap on integer overflow"), llvm::cl::init(false)); -void InitializeOverflowChecking(LangOptions &Options) { - Options.OverflowChecking = OverflowChecking; -} //===----------------------------------------------------------------------===// // Target Triple Processing. //===----------------------------------------------------------------------===// @@ -2299,8 +2286,8 @@ int main(int argc, char **argv) { LangKind LK = GetLanguage(InFile); InitializeLangOptions(LangInfo, LK); InitializeGCMode(LangInfo); - InitializeSymbolVisibility(LangInfo); - InitializeOverflowChecking(LangInfo); + LangInfo.setVisibilityMode(SymbolVisibility); + LangInfo.OverflowChecking = OverflowChecking; InitializeLanguageStandard(LangInfo, LK, Target.get()); // Process the -I options and set them in the HeaderInfo. |