forked from OSchip/llvm-project
Fixed coding convention naming issue - variable names start with uppercase.
llvm-svn: 188070
This commit is contained in:
parent
7f915cf8a5
commit
bb0a3b0668
|
@ -175,45 +175,45 @@ cl::opt<std::string> HeaderPrefix(
|
||||||
" the files are considered to be relative to the header list file."));
|
" the files are considered to be relative to the header list file."));
|
||||||
|
|
||||||
// Read the header list file and collect the header file names.
|
// Read the header list file and collect the header file names.
|
||||||
error_code getHeaderFileNames(SmallVectorImpl<std::string> &headerFileNames,
|
error_code getHeaderFileNames(SmallVectorImpl<std::string> &HeaderFileNames,
|
||||||
StringRef listFileName, StringRef headerPrefix) {
|
StringRef ListFileName, StringRef HeaderPrefix) {
|
||||||
|
|
||||||
// By default, use the path component of the list file name.
|
// By default, use the path component of the list file name.
|
||||||
SmallString<256> headerDirectory(listFileName);
|
SmallString<256> HeaderDirectory(ListFileName);
|
||||||
sys::path::remove_filename(headerDirectory);
|
sys::path::remove_filename(HeaderDirectory);
|
||||||
|
|
||||||
// Get the prefix if we have one.
|
// Get the prefix if we have one.
|
||||||
if (headerPrefix.size() != 0)
|
if (HeaderPrefix.size() != 0)
|
||||||
headerDirectory = headerPrefix;
|
HeaderDirectory = HeaderPrefix;
|
||||||
|
|
||||||
// Read the header list file into a buffer.
|
// Read the header list file into a buffer.
|
||||||
OwningPtr<MemoryBuffer> listBuffer;
|
OwningPtr<MemoryBuffer> listBuffer;
|
||||||
if (error_code ec = MemoryBuffer::getFile(listFileName, listBuffer)) {
|
if (error_code ec = MemoryBuffer::getFile(ListFileName, listBuffer)) {
|
||||||
return ec;
|
return ec;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse the header list into strings.
|
// Parse the header list into strings.
|
||||||
SmallVector<StringRef, 32> strings;
|
SmallVector<StringRef, 32> Strings;
|
||||||
listBuffer->getBuffer().split(strings, "\n", -1, false);
|
listBuffer->getBuffer().split(Strings, "\n", -1, false);
|
||||||
|
|
||||||
// Collect the header file names from the string list.
|
// Collect the header file names from the string list.
|
||||||
for (SmallVectorImpl<StringRef>::iterator I = strings.begin(),
|
for (SmallVectorImpl<StringRef>::iterator I = Strings.begin(),
|
||||||
E = strings.end();
|
E = Strings.end();
|
||||||
I != E; ++I) {
|
I != E; ++I) {
|
||||||
StringRef line = (*I).trim();
|
StringRef Line = (*I).trim();
|
||||||
// Ignore comments and empty lines.
|
// Ignore comments and empty lines.
|
||||||
if (line.empty() || (line[0] == '#'))
|
if (Line.empty() || (Line[0] == '#'))
|
||||||
continue;
|
continue;
|
||||||
SmallString<256> headerFileName;
|
SmallString<256> HeaderFileName;
|
||||||
// Prepend header file name prefix if it's not absolute.
|
// Prepend header file name prefix if it's not absolute.
|
||||||
if (sys::path::is_absolute(line))
|
if (sys::path::is_absolute(Line))
|
||||||
headerFileName = line;
|
HeaderFileName = Line;
|
||||||
else {
|
else {
|
||||||
headerFileName = headerDirectory;
|
HeaderFileName = HeaderDirectory;
|
||||||
sys::path::append(headerFileName, line);
|
sys::path::append(HeaderFileName, Line);
|
||||||
}
|
}
|
||||||
// Save the resulting header file path.
|
// Save the resulting header file path.
|
||||||
headerFileNames.push_back(headerFileName.str());
|
HeaderFileNames.push_back(HeaderFileName.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
return error_code::success();
|
return error_code::success();
|
||||||
|
@ -513,10 +513,10 @@ private:
|
||||||
PreprocessorTracker &PPTracker;
|
PreprocessorTracker &PPTracker;
|
||||||
};
|
};
|
||||||
|
|
||||||
int main(int argc, const char **argv) {
|
int main(int Argc, const char **Argv) {
|
||||||
|
|
||||||
// This causes options to be parsed.
|
// This causes options to be parsed.
|
||||||
cl::ParseCommandLineOptions(argc, argv, "modularize.\n");
|
cl::ParseCommandLineOptions(Argc, Argv, "modularize.\n");
|
||||||
|
|
||||||
// No go if we have no header list file.
|
// No go if we have no header list file.
|
||||||
if (ListFileName.size() == 0) {
|
if (ListFileName.size() == 0) {
|
||||||
|
@ -526,9 +526,9 @@ int main(int argc, const char **argv) {
|
||||||
|
|
||||||
// Get header file names.
|
// Get header file names.
|
||||||
SmallVector<std::string, 32> Headers;
|
SmallVector<std::string, 32> Headers;
|
||||||
if (error_code ec = getHeaderFileNames(Headers, ListFileName, HeaderPrefix)) {
|
if (error_code EC = getHeaderFileNames(Headers, ListFileName, HeaderPrefix)) {
|
||||||
errs() << argv[0] << ": error: Unable to get header list '" << ListFileName
|
errs() << Argv[0] << ": error: Unable to get header list '" << ListFileName
|
||||||
<< "': " << ec.message() << '\n';
|
<< "': " << EC.message() << '\n';
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -552,10 +552,10 @@ int main(int argc, const char **argv) {
|
||||||
typedef SmallVector<Location, 8> LocationArray;
|
typedef SmallVector<Location, 8> LocationArray;
|
||||||
typedef SmallVector<LocationArray, Entry::EK_NumberOfKinds> EntryBinArray;
|
typedef SmallVector<LocationArray, Entry::EK_NumberOfKinds> EntryBinArray;
|
||||||
EntryBinArray EntryBins;
|
EntryBinArray EntryBins;
|
||||||
int kindIndex;
|
int KindIndex;
|
||||||
for (kindIndex = 0; kindIndex < Entry::EK_NumberOfKinds; ++kindIndex) {
|
for (KindIndex = 0; KindIndex < Entry::EK_NumberOfKinds; ++KindIndex) {
|
||||||
LocationArray array;
|
LocationArray Array;
|
||||||
EntryBins.push_back(array);
|
EntryBins.push_back(Array);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for the same entity being defined in multiple places.
|
// Check for the same entity being defined in multiple places.
|
||||||
|
@ -575,15 +575,15 @@ int main(int argc, const char **argv) {
|
||||||
EntryBins[E->second[I].Kind].push_back(E->second[I].Loc);
|
EntryBins[E->second[I].Kind].push_back(E->second[I].Loc);
|
||||||
}
|
}
|
||||||
// Report any duplicate entity definition errors.
|
// Report any duplicate entity definition errors.
|
||||||
int kindIndex = 0;
|
int KindIndex = 0;
|
||||||
for (EntryBinArray::iterator DI = EntryBins.begin(), DE = EntryBins.end();
|
for (EntryBinArray::iterator DI = EntryBins.begin(), DE = EntryBins.end();
|
||||||
DI != DE; ++DI, ++kindIndex) {
|
DI != DE; ++DI, ++KindIndex) {
|
||||||
int eCount = DI->size();
|
int ECount = DI->size();
|
||||||
// If only 1 occurance, skip;
|
// If only 1 occurance, skip;
|
||||||
if (eCount <= 1)
|
if (ECount <= 1)
|
||||||
continue;
|
continue;
|
||||||
LocationArray::iterator FI = DI->begin();
|
LocationArray::iterator FI = DI->begin();
|
||||||
StringRef kindName = Entry::getKindName((Entry::EntryKind)kindIndex);
|
StringRef kindName = Entry::getKindName((Entry::EntryKind)KindIndex);
|
||||||
errs() << "error: " << kindName << " '" << E->first()
|
errs() << "error: " << kindName << " '" << E->first()
|
||||||
<< "' defined at multiple locations:\n";
|
<< "' defined at multiple locations:\n";
|
||||||
for (LocationArray::iterator FE = DI->end(); FI != FE; ++FI) {
|
for (LocationArray::iterator FE = DI->end(); FI != FE; ++FI) {
|
||||||
|
|
Loading…
Reference in New Issue