[PATCH] D24926: Added support of configuration files
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 27 01:58:57 PDT 2016
ABataev added a subscriber: ABataev.
================
Comment at: lib/Support/CommandLine.cpp:956
@@ +955,3 @@
+ FilePath.clear();
+ if (Dir[0] == '~') {
+ assert(llvm::sys::path::is_separator(Dir[1]));
----------------
What if Dir is nullptr?
================
Comment at: lib/Support/CommandLine.cpp:977
@@ +976,3 @@
+ StringRef ToolName) {
+ StringRef ProgramFullPath = Argv[0];
+ CfgFileName.clear();
----------------
What if Argv is empty?
================
Comment at: lib/Support/CommandLine.cpp:984
@@ +983,3 @@
+ // specified by it.
+ auto cfg_option = std::find_if(Argv.begin(), Argv.end(), [](const char *x) {
+ return strcmp(x, "--config") == 0;
----------------
'cfg_option' does not follow LLVM coding standard. And 'x'
================
Comment at: lib/Support/CommandLine.cpp:1000-1001
@@ +999,4 @@
+ if (!llvm::sys::path::has_parent_path(CfgFile)) {
+ if (!StringRef(CfgFile).endswith(".cfg"))
+ CfgFile += ".cfg";
+
----------------
Use llvm::sys::path::replace_extension(CfgFile, ".cfg")
================
Comment at: lib/Support/CommandLine.cpp:1036
@@ +1035,3 @@
+ return CfgFileSearch::Successful;
+ else
+ return CfgFileSearch::Ignored;
----------------
Remove 'else', unconditional 'return CfgFileSearch::Ignored;'
================
Comment at: lib/Support/CommandLine.cpp:1142
@@ +1141,3 @@
+ if (*Cur == '\n' &&
+ !(Cur[-1] == '\\' || (Cur[-1] == '\r' && Cur[-2] == '\\')))
+ break;
----------------
What if Cur == Source.begin()?
https://reviews.llvm.org/D24926
More information about the llvm-commits
mailing list