-
Notifications
You must be signed in to change notification settings - Fork 18
support for the -stdlib flag
#27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,12 +27,13 @@ type Invocation struct { | |
| sessionID uint32 // incremental while a daemon is alive | ||
|
|
||
| // cmdLine is parsed to the following fields: | ||
| cppInFile string // input file as specified in cmd line (.cpp for compilation, .h for pch generation) | ||
| objOutFile string // output file as specified in cmd line (.o for compilation, .gch/.pch for pch generation) | ||
| cxxName string // g++ / clang / etc. | ||
| cxxArgs []string // args like -Wall, -fpch-preprocess and many more, except: | ||
| cxxIDirs IncludeDirs // -I / -iquote / -isystem go here | ||
| depsFlags DepCmdFlags // -MD -MF file and others, used for .d files generation (not passed to server) | ||
| cppInFile string // input file as specified in cmd line (.cpp for compilation, .h for pch generation) | ||
| objOutFile string // output file as specified in cmd line (.o for compilation, .gch/.pch for pch generation) | ||
| cxxName string // g++ / clang / etc. | ||
| cxxArgs []string // args like -Wall, -fpch-preprocess and many more, except: | ||
| cxxArgsIncludes []string // TODO | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TODO mark is present but not explained |
||
| cxxIDirs IncludeDirs // -I / -iquote / -isystem go here | ||
| depsFlags DepCmdFlags // -MD -MF file and others, used for .d files generation (not passed to server) | ||
|
|
||
| waitUploads int32 // files still waiting for upload to finish; 0 releases wgUpload; see Invocation.DoneUploadFile | ||
| doneRecv int32 // 1 if o file received or failed receiving; 1 releases wgRecv; see Invocation.DoneRecvObj | ||
|
|
@@ -73,13 +74,14 @@ func pathAbs(cwd string, relPath string) string { | |
|
|
||
| func ParseCmdLineInvocation(daemon *Daemon, cwd string, cmdLine []string) (invocation *Invocation) { | ||
| invocation = &Invocation{ | ||
| createTime: time.Now(), | ||
| sessionID: atomic.AddUint32(&daemon.totalInvocations, 1), | ||
| cxxName: cmdLine[0], | ||
| cxxArgs: make([]string, 0, 10), | ||
| cxxIDirs: MakeIncludeDirs(), | ||
| summary: MakeInvocationSummary(), | ||
| includesCache: daemon.GetOrCreateIncludesCache(cmdLine[0]), | ||
| createTime: time.Now(), | ||
| sessionID: atomic.AddUint32(&daemon.totalInvocations, 1), | ||
| cxxName: cmdLine[0], | ||
| cxxArgs: make([]string, 0, 10), | ||
| cxxArgsIncludes: make([]string, 0, 1), | ||
| cxxIDirs: MakeIncludeDirs(), | ||
| summary: MakeInvocationSummary(), | ||
| includesCache: nil, // TODO | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ? |
||
| } | ||
|
|
||
| parseArgFile := func(key string, arg string, argIndex *int) (string, bool) { | ||
|
|
@@ -113,6 +115,14 @@ func ParseCmdLineInvocation(daemon *Daemon, cwd string, cmdLine []string) (invoc | |
| return "" | ||
| } | ||
|
|
||
| parsePartsArgString := func(arg string) string { | ||
| parts := strings.SplitN(arg, "=", 2) | ||
| if len(parts) != 2 { | ||
| return arg | ||
| } | ||
| return parts[1] | ||
| } | ||
|
|
||
| for i := 1; i < len(cmdLine); i++ { | ||
| arg := cmdLine[i] | ||
| if len(arg) == 0 { | ||
|
|
@@ -183,6 +193,9 @@ func ParseCmdLineInvocation(daemon *Daemon, cwd string, cmdLine []string) (invoc | |
| invocation.cxxArgs = append(invocation.cxxArgs, "-Xclang", xArg) | ||
| i++ | ||
| continue | ||
| } else if strings.HasPrefix(arg, "-stdlib=") { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. from clang docs: |
||
| invocation.cxxArgsIncludes = append(invocation.cxxArgsIncludes, parsePartsArgString(arg)) | ||
| continue | ||
| } | ||
| } else if isSourceFileName(arg) || isHeaderFileName(arg) { | ||
| if invocation.cppInFile != "" { | ||
|
|
@@ -198,6 +211,8 @@ func ParseCmdLineInvocation(daemon *Daemon, cwd string, cmdLine []string) (invoc | |
| invocation.cxxArgs = append(invocation.cxxArgs, arg) | ||
| } | ||
|
|
||
| invocation.includesCache = daemon.GetOrCreateIncludesCache(invocation.cxxName, invocation.cxxArgsIncludes) | ||
|
|
||
| if invocation.err != nil { | ||
| return | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't it be replaced?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And for what and why?