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

Side by Side Diff: src/IceMangling.cpp

Issue 1848303003: Simplify references to command line flags. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix nits. Created 4 years, 8 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/IceInstX86BaseImpl.h ('k') | src/IceOperand.h » ('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/IceMangling.cpp - Cross test name mangling --*- C++ -*-===// 1 //===- subzero/src/IceMangling.cpp - Cross test name mangling --*- C++ -*-===//
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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 // namespace. For other symbols, just prepend the prefix. 119 // namespace. For other symbols, just prepend the prefix.
120 std::string mangleName(const std::string &Name) { 120 std::string mangleName(const std::string &Name) {
121 // An already-nested name like foo::bar() gets pushed down one level, making 121 // An already-nested name like foo::bar() gets pushed down one level, making
122 // it equivalent to Prefix::foo::bar(). 122 // it equivalent to Prefix::foo::bar().
123 // _ZN3foo3barExyz ==> _ZN6Prefix3foo3barExyz 123 // _ZN3foo3barExyz ==> _ZN6Prefix3foo3barExyz
124 // A non-nested but mangled name like bar() gets nested, making it equivalent 124 // A non-nested but mangled name like bar() gets nested, making it equivalent
125 // to Prefix::bar(). 125 // to Prefix::bar().
126 // _Z3barxyz ==> ZN6Prefix3barExyz 126 // _Z3barxyz ==> ZN6Prefix3barExyz
127 // An unmangled, extern "C" style name, gets a simple prefix: 127 // An unmangled, extern "C" style name, gets a simple prefix:
128 // bar ==> Prefixbar 128 // bar ==> Prefixbar
129 if (!BuildDefs::dump() || GlobalContext::getFlags().getTestPrefix().empty()) 129 if (!BuildDefs::dump() || getFlags().getTestPrefix().empty())
130 return Name; 130 return Name;
131 131
132 const std::string TestPrefix = GlobalContext::getFlags().getTestPrefix(); 132 const std::string TestPrefix = getFlags().getTestPrefix();
133 unsigned PrefixLength = TestPrefix.length(); 133 unsigned PrefixLength = TestPrefix.length();
134 ManglerVector NameBase(1 + Name.length()); 134 ManglerVector NameBase(1 + Name.length());
135 const size_t BufLen = 30 + Name.length() + PrefixLength; 135 const size_t BufLen = 30 + Name.length() + PrefixLength;
136 ManglerVector NewName(BufLen); 136 ManglerVector NewName(BufLen);
137 uint32_t BaseLength = 0; // using uint32_t due to sscanf format string 137 uint32_t BaseLength = 0; // using uint32_t due to sscanf format string
138 138
139 int ItemsParsed = sscanf(Name.c_str(), "_ZN%s", NameBase.data()); 139 int ItemsParsed = sscanf(Name.c_str(), "_ZN%s", NameBase.data());
140 if (ItemsParsed == 1) { 140 if (ItemsParsed == 1) {
141 // Transform _ZN3foo3barExyz ==> _ZN6Prefix3foo3barExyz 141 // Transform _ZN3foo3barExyz ==> _ZN6Prefix3foo3barExyz
142 // (splice in "6Prefix") ^^^^^^^ 142 // (splice in "6Prefix") ^^^^^^^
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 incrementSubstitutions(NewName); 184 incrementSubstitutions(NewName);
185 return NewName.data(); 185 return NewName.data();
186 } 186 }
187 187
188 // Transform bar ==> Prefixbar 188 // Transform bar ==> Prefixbar
189 // ^^^^^^ 189 // ^^^^^^
190 return TestPrefix + Name; 190 return TestPrefix + Name;
191 } 191 }
192 192
193 } // end of namespace Ice 193 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceInstX86BaseImpl.h ('k') | src/IceOperand.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698