Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
8b727538
Kaydet (Commit)
8b727538
authored
Ara 23, 2012
tarafından
Lubos Lunak
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
better error handling when writing modified source
üst
e1b11cc4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
10 deletions
+17
-10
plugin.cxx
compilerplugins/clang/plugin.cxx
+17
-10
No files found.
compilerplugins/clang/plugin.cxx
Dosyayı görüntüle @
8b727538
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
#include <clang/Frontend/CompilerInstance.h>
#include <clang/Frontend/CompilerInstance.h>
#include <clang/Frontend/FrontendAction.h>
#include <clang/Frontend/FrontendAction.h>
#include <clang/Frontend/FrontendPluginRegistry.h>
#include <clang/Frontend/FrontendPluginRegistry.h>
#include <stdio.h>
#include "bodynotinblock.hxx"
#include "bodynotinblock.hxx"
#include "lclstaticfix.hxx"
#include "lclstaticfix.hxx"
...
@@ -180,19 +181,25 @@ class PluginHandler
...
@@ -180,19 +181,25 @@ class PluginHandler
++
it
)
++
it
)
{
{
const
FileEntry
*
e
=
context
.
getSourceManager
().
getFileEntryForID
(
it
->
first
);
const
FileEntry
*
e
=
context
.
getSourceManager
().
getFileEntryForID
(
it
->
first
);
string
filename
=
std
::
string
(
e
->
getName
())
+
".new"
;
char
*
filename
=
new
char
[
strlen
(
e
->
getName
())
+
100
];
sprintf
(
filename
,
"%s.new.%d"
,
e
->
getName
(),
getpid
());
string
error
;
string
error
;
// TODO If there will be actually plugins also modifying headers,
bool
ok
=
false
;
// race conditions should be avoided here.
raw_fd_ostream
ostream
(
filename
,
error
);
raw_fd_ostream
ostream
(
filename
.
c_str
(),
error
);
DiagnosticsEngine
&
diag
=
context
.
getDiagnostics
();
DiagnosticsEngine
&
diag
=
context
.
getDiagnostics
();
if
(
!
error
.
empty
())
if
(
error
.
empty
())
{
it
->
second
.
write
(
ostream
);
ostream
.
close
();
if
(
!
ostream
.
has_error
()
&&
rename
(
filename
,
e
->
getName
())
==
0
)
ok
=
true
;
}
ostream
.
clear_error
();
unlink
(
filename
);
if
(
!
ok
)
diag
.
Report
(
diag
.
getCustomDiagID
(
DiagnosticsEngine
::
Error
,
diag
.
Report
(
diag
.
getCustomDiagID
(
DiagnosticsEngine
::
Error
,
"cannot write modified source to %0 (%1) [loplugin]"
))
<<
filename
<<
error
;
"cannot write modified source to %0 (%1) [loplugin]"
))
<<
e
->
getName
()
<<
error
;
else
delete
[]
filename
;
diag
.
Report
(
diag
.
getCustomDiagID
(
DiagnosticsEngine
::
Note
,
"modified source %0 [loplugin]"
))
<<
filename
;
it
->
second
.
write
(
ostream
);
}
}
}
}
private
:
private
:
...
...
Write
Preview
Markdown
is supported
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