Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(297)

Side by Side Diff: src/IceClFlags.cpp

Issue 1961743002: Subzero: Update for LLVM 3.9 (trunk). (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero@master
Patch Set: Remove unnecessary variable Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/IceClFlags.h ('k') | src/IceCompileServer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceClFlags.cpp - Command line flags and parsing --------===// 1 //===- subzero/src/IceClFlags.cpp - Command line flags and parsing --------===//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 /// 9 ///
10 /// \file 10 /// \file
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 // toSetterParam is template magic that is needed to convert between (llvm::)cl 156 // toSetterParam is template magic that is needed to convert between (llvm::)cl
157 // objects and the arguments to ClFlags' setters. ToSetterParam is a traits 157 // objects and the arguments to ClFlags' setters. ToSetterParam is a traits
158 // object that we need in order for the multiple specializations to 158 // object that we need in order for the multiple specializations to
159 // toSetterParam to agree on their return type. 159 // toSetterParam to agree on their return type.
160 template <typename T> struct ToSetterParam { using ReturnType = const T &; }; 160 template <typename T> struct ToSetterParam { using ReturnType = const T &; };
161 161
162 template <> struct ToSetterParam<cl::list<Ice::VerboseItem>> { 162 template <> struct ToSetterParam<cl::list<Ice::VerboseItem>> {
163 using ReturnType = Ice::VerboseMask; 163 using ReturnType = Ice::VerboseMask;
164 }; 164 };
165 165
166 template <> struct ToSetterParam<cl::list<std::string>> {
167 using ReturnType = std::vector<std::string>;
168 };
169
166 template <typename T> 170 template <typename T>
167 typename ToSetterParam<T>::ReturnType toSetterParam(const T &Param) { 171 typename ToSetterParam<T>::ReturnType toSetterParam(const T &Param) {
168 return Param; 172 return Param;
169 } 173 }
170 174
171 template <> 175 template <>
172 ToSetterParam<cl::list<Ice::VerboseItem>>::ReturnType 176 ToSetterParam<cl::list<Ice::VerboseItem>>::ReturnType
173 toSetterParam(const cl::list<Ice::VerboseItem> &Param) { 177 toSetterParam(const cl::list<Ice::VerboseItem> &Param) {
174 Ice::VerboseMask VMask = Ice::IceV_None; 178 Ice::VerboseMask VMask = Ice::IceV_None;
175 // Don't generate verbose messages if routines to dump messages are not 179 // Don't generate verbose messages if routines to dump messages are not
176 // available. 180 // available.
177 if (BuildDefs::dump()) { 181 if (BuildDefs::dump()) {
178 for (unsigned i = 0; i != Param.size(); ++i) 182 for (unsigned i = 0; i != Param.size(); ++i)
179 VMask |= Param[i]; 183 VMask |= Param[i];
180 } 184 }
181 return VMask; 185 return VMask;
182 } 186 }
183 187
188 template <>
189 ToSetterParam<cl::list<std::string>>::ReturnType
190 toSetterParam(const cl::list<std::string> &Param) {
191 return *&Param;
192 }
193
184 } // end of anonymous namespace 194 } // end of anonymous namespace
185 195
186 void ClFlags::getParsedClFlags(ClFlags &OutFlags) { 196 void ClFlags::getParsedClFlags(ClFlags &OutFlags) {
187 #define X(Name, Type, ClType, ...) OutFlags.set##Name(toSetterParam(Name##Obj)); 197 #define X(Name, Type, ClType, ...) OutFlags.set##Name(toSetterParam(Name##Obj));
188 COMMAND_LINE_FLAGS 198 COMMAND_LINE_FLAGS
189 #undef X 199 #undef X
190 200
191 // If any value needs a non-trivial parsed value, set it below. 201 // If any value needs a non-trivial parsed value, set it below.
192 OutFlags.setAllowExternDefinedSymbols(AllowExternDefinedSymbolsObj || 202 OutFlags.setAllowExternDefinedSymbols(AllowExternDefinedSymbolsObj ||
193 DisableInternalObj); 203 DisableInternalObj);
194 OutFlags.setDisableHybridAssembly(DisableHybridAssemblyObj || 204 OutFlags.setDisableHybridAssembly(DisableHybridAssemblyObj ||
195 (OutFileTypeObj != Ice::FT_Iasm)); 205 (OutFileTypeObj != Ice::FT_Iasm));
196 OutFlags.ForceO2.init(OutFlags.getForceO2String()); 206 OutFlags.ForceO2.init(OutFlags.getForceO2String());
197 OutFlags.TestStatus.init(OutFlags.getTestStatusString()); 207 OutFlags.TestStatus.init(OutFlags.getTestStatusString());
198 OutFlags.TimingFocus.init(OutFlags.getTimingFocusOnString()); 208 OutFlags.TimingFocus.init(OutFlags.getTimingFocusOnString());
199 OutFlags.TranslateOnly.init(OutFlags.getTranslateOnlyString()); 209 OutFlags.TranslateOnly.init(OutFlags.getTranslateOnlyString());
200 OutFlags.VerboseFocus.init(OutFlags.getVerboseFocusOnString()); 210 OutFlags.VerboseFocus.init(OutFlags.getVerboseFocusOnString());
201 } 211 }
202 212
203 } // end of namespace Ice 213 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceClFlags.h ('k') | src/IceCompileServer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698