Skip to content

Instantly share code, notes, and snippets.

View yamaguchi1024's full-sized avatar
🐈

Yuka Ikarashi yamaguchi1024

🐈
View GitHub Profile
Yukas-MacBook:llvm-project yamaguchi$ git grep ".find(\"=\")"
lld/ELF/Driver.cpp: size_t Pos = Value.find("=");
Yukas-MacBook:llvm-project yamaguchi$ git grep ".split(\"=\")"
clang/include/clang/Basic/Attr.td: Ret.second = Feature.split("=").second.trim();
clang/lib/Frontend/CompilerInvocation.cpp: std::tie(key, val) = configVals[i].split("=");
compiler-rt/test/sanitizer_common/ios_commands/iossim_env.py: (argname, argval) = arg.split("=")
lld/COFF/DriverUtils.cpp: std::tie(X, Y) = E.Name.split("=");
lldb/packages/Python/lldbsuite/test/dotest.py: key_val_entry = keyval.split("=")
lldb/www/python_reference/epydoc.js: var target = target_list[i].split("=");
llvm/lib/Support/SpecialCaseList.cpp: std::pair<StringRef, StringRef> SplitRegexp = SplitLine.second.split("=");
diff --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td b/clang/include/clang/Basic/DiagnosticDriverKinds.td
index 3833f0f..c401198 100644
--- a/clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -45,7 +45,7 @@ def err_drv_invalid_rtlib_name : Error<
def err_drv_unsupported_rtlib_for_platform : Error<
"unsupported runtime library '%0' for platform '%1'">;
def err_drv_invalid_stdlib_name : Error<
- "invalid library name in argument '%0'">;
+ "invalid library name in argument '%0'. Do you mean "%1"? ">;
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 6e52e7e..f4eaa28 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -649,8 +649,9 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
Opts.NoUseJumpTables = Args.hasArg(OPT_fno_jump_tables);
Opts.PrepareForLTO = Args.hasArg(OPT_flto, OPT_flto_EQ);
- const Arg *A = Args.getLastArg(OPT_flto, OPT_flto_EQ);
- Opts.EmitSummaryIndex = A && A->containsValue("thin");
@yamaguchi1024
yamaguchi1024 / wtd.txt
Last active June 7, 2017 08:51
Value Completion
I suggest to implement the value completion which flags are handled in clang Driver.
Some flags pass the value string directly to further process, which is too hard to chase and few people would use those flag.
Eg. "clang foo.a -Wa,--foobar -o foo" will execute "as --foobar -o foo", and Driver has no information about --foobar.
I've researched flags which take a value as an argument.
As you can see, there are some flags which includes .def files, and I think it's reasonable to merge its information to Options.td using tablegen.
Many of "No fixed value" flags were passing value "foobar" as string to further process or using it as a string.
#include <cstdio>
#include <iostream>
#include <string>
#include <fstream>
#include <map>
#include <algorithm>
using namespace std;
typedef pair<string, string> P;
%{
open Syntax
%}
%token <int> INT
%token <bool> BOOL
%token <string> ID
%token LET IN
%token PLUS TIMES MINUS DIV
%token AND OR
.-(~/llvm-project-20170507)---------------------------------------------------------------------------(yamaguchi@ubu)-
`--> llvm/utils/git-svn/git-llvm push
Pushing 1 commit:
37cb5870 [GSoC] Shell autocompletion for clang
Traceback (most recent call last):
File "llvm/utils/git-svn/git-llvm", line 350, in <module>
args.func(args)
File "llvm/utils/git-svn/git-llvm", line 307, in cmd_push
clean_and_update_svn(svn_root)
File "llvm/utils/git-svn/git-llvm", line 165, in clean_and_update_svn
`--> git-llvm push
Creating svn staging directory: (.git/llvm-upstream-svn)
This is a one-time initialization, please be patient for a few minutes...
Traceback (most recent call last):
File "/home/yamaguchi/llvm-project/llvm/utils/git-svn//git-llvm", line 350, in <module>
args.func(args)
File "/home/yamaguchi/llvm-project/llvm/utils/git-svn//git-llvm", line 297, in cmd_push
svn_init(svn_root)
File "/home/yamaguchi/llvm-project/llvm/utils/git-svn//git-llvm", line 185, in svn_init
'https://llvm.org/svn/llvm-project/', '.')
.-(~/llvm-project)------------------------------------------------------------------------------------(yamaguchi@ubu)-
`--> git-llvm push
^CTraceback (most recent call last):
File "/home/yamaguchi/llvm-project/llvm/utils/git-svn//git-llvm", line 350, in <module>
args.func(args)
File "/home/yamaguchi/llvm-project/llvm/utils/git-svn//git-llvm", line 301, in cmd_push
revs = get_revs_to_push(rev_range)
File "/home/yamaguchi/llvm-project/llvm/utils/git-svn//git-llvm", line 158, in get_revs_to_push
'--pretty=%h', rev_range).splitlines()
File "/home/yamaguchi/llvm-project/llvm/utils/git-svn//git-llvm", line 128, in git
diff --git a/clang/include/clang/Driver/Options.h b/clang/include/clang/Driver/Options.h
index 57e4452..382e618 100644
--- a/clang/include/clang/Driver/Options.h
+++ b/clang/include/clang/Driver/Options.h
@@ -40,7 +40,7 @@ enum ClangFlags {
enum ID {
OPT_INVALID = 0, // This is not an option ID.
#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS, PARAM, \
- HELPTEXT, METAVAR) OPT_##ID,
+ HELPTEXT, METAVAR, VALUE) OPT_##ID,