Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Christian Dietrich
clang-hash
Commits
15462d94
Commit
15462d94
authored
Jan 16, 2017
by
Christian Dietrich
Browse files
plugin: fix copying of object file
parent
8b9169a3
Pipeline
#3003
passed with stage
in 0 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/clang-hash.cc
View file @
15462d94
...
...
@@ -104,19 +104,35 @@ public:
}
}
*
Terminal
<<
"]
\n
"
;
*
Terminal
<<
"skipped: "
<<
(
StopCompiling
?
"true"
:
"false"
)
<<
"
\n
"
;
}
if
(
StopCompiling
)
{
struct
stat
dummy
;
// Object file not existing. Copy it from the backup
if
(
stat
(
OutputFile
.
c_str
(),
&
dummy
)
==
-
1
)
{
bool
copy_exists
=
(
stat
(
OutputFileCopy
.
c_str
(),
&
dummy
)
==
0
);
bool
orig_exists
=
(
stat
(
OutputFileCopy
.
c_str
(),
&
dummy
)
==
0
);
if
(
copy_exists
)
{
if
(
orig_exists
)
{
unlink
(
OutputFile
.
c_str
());
}
link
(
OutputFileCopy
.
c_str
(),
OutputFile
.
c_str
());
if
(
stat
(
OutputFile
.
c_str
(),
&
dummy
)
==
0
)
{
if
(
utime
(
OutputFile
.
c_str
(),
nullptr
)
==
0
)
{
// touch object file
if
(
Terminal
)
{
*
Terminal
<<
"skipped: true
\n
"
;
}
exit
(
0
);
}
}
}
utime
(
OutputFile
.
c_str
(),
nullptr
);
// touch object file
exit
(
0
);
}
if
(
Terminal
)
{
*
Terminal
<<
"skipped: false
\n
"
;
}
}
private:
...
...
@@ -179,6 +195,7 @@ protected:
const
std
::
string
PreviousHashString
=
getHashFromFile
(
HashFile
);
// Write hash database to .o.hash if the compiler produces a object file
if
((
CI
.
getFrontendOpts
().
ProgramAction
==
frontend
::
EmitObj
||
CI
.
getFrontendOpts
().
ProgramAction
==
frontend
::
EmitBC
||
CI
.
getFrontendOpts
().
ProgramAction
==
frontend
::
EmitLLVM
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment