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
b4392c57
Kaydet (Commit)
b4392c57
authored
Şub 02, 2013
tarafından
Luboš Luňák
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
always use the report() helper
Change-Id: I2966fdb5bd98b1ddf718079584acf90a3e3a3700
üst
efe9bf61
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
29 deletions
+30
-29
plugin.cxx
compilerplugins/clang/plugin.cxx
+7
-3
plugin.hxx
compilerplugins/clang/plugin.hxx
+3
-1
pluginhandler.cxx
compilerplugins/clang/pluginhandler.cxx
+14
-17
pluginhandler.hxx
compilerplugins/clang/pluginhandler.hxx
+2
-0
postfixincrementfix.cxx
compilerplugins/clang/postfixincrementfix.cxx
+4
-8
No files found.
compilerplugins/clang/plugin.cxx
Dosyayı görüntüle @
b4392c57
...
...
@@ -27,6 +27,12 @@ Plugin::Plugin( ASTContext& context )
}
DiagnosticBuilder
Plugin
::
report
(
DiagnosticsEngine
::
Level
level
,
StringRef
message
,
SourceLocation
loc
)
{
return
report
(
level
,
message
,
context
,
loc
);
}
DiagnosticBuilder
Plugin
::
report
(
DiagnosticsEngine
::
Level
level
,
StringRef
message
,
ASTContext
&
context
,
SourceLocation
loc
)
{
DiagnosticsEngine
&
diag
=
context
.
getDiagnostics
();
#if 0
...
...
@@ -168,9 +174,7 @@ bool RewritePlugin::replaceText( SourceRange range, SourceRange replacementRange
bool
RewritePlugin
::
reportEditFailure
(
SourceLocation
loc
)
{
DiagnosticsEngine
&
diag
=
context
.
getDiagnostics
();
diag
.
Report
(
loc
,
diag
.
getCustomDiagID
(
DiagnosticsEngine
::
Warning
,
"cannot perform source modification (macro expansion involved?) [loplugin]"
));
report
(
DiagnosticsEngine
::
Warning
,
"cannot perform source modification (macro expansion involved?) [loplugin]"
,
loc
);
return
false
;
}
...
...
compilerplugins/clang/plugin.hxx
Dosyayı görüntüle @
b4392c57
...
...
@@ -41,8 +41,10 @@ class Plugin
virtual
~
Plugin
();
virtual
void
run
()
=
0
;
template
<
typename
T
>
class
Registration
;
protected
:
DiagnosticBuilder
report
(
DiagnosticsEngine
::
Level
level
,
StringRef
message
,
SourceLocation
loc
=
SourceLocation
());
static
DiagnosticBuilder
report
(
DiagnosticsEngine
::
Level
level
,
StringRef
message
,
ASTContext
&
context
,
SourceLocation
loc
=
SourceLocation
());
protected
:
bool
ignoreLocation
(
SourceLocation
loc
);
bool
ignoreLocation
(
const
Decl
*
decl
);
bool
ignoreLocation
(
const
Stmt
*
stmt
);
...
...
compilerplugins/clang/pluginhandler.cxx
Dosyayı görüntüle @
b4392c57
...
...
@@ -37,7 +37,8 @@ static int pluginCount = 0;
static
bool
pluginObjectsCreated
=
false
;
PluginHandler
::
PluginHandler
(
ASTContext
&
context
,
const
vector
<
string
>&
args
)
:
rewriter
(
context
.
getSourceManager
(),
context
.
getLangOpts
())
:
context
(
context
)
,
rewriter
(
context
.
getSourceManager
(),
context
.
getLangOpts
())
{
bool
wasCreated
=
false
;
for
(
int
i
=
0
;
...
...
@@ -60,11 +61,7 @@ PluginHandler::PluginHandler( ASTContext& context, const vector< string >& args
}
pluginObjectsCreated
=
true
;
if
(
!
args
.
empty
()
&&
!
wasCreated
)
{
DiagnosticsEngine
&
diag
=
context
.
getDiagnostics
();
diag
.
Report
(
diag
.
getCustomDiagID
(
DiagnosticsEngine
::
Fatal
,
"unknown plugin tool %0 [loplugin]"
))
<<
args
.
front
();
}
report
(
DiagnosticsEngine
::
Fatal
,
"unknown plugin tool %0 [loplugin]"
)
<<
args
.
front
();
}
PluginHandler
::~
PluginHandler
()
...
...
@@ -87,6 +84,11 @@ void PluginHandler::registerPlugin( Plugin* (*create)( ASTContext&, Rewriter& ),
++
pluginCount
;
}
DiagnosticBuilder
PluginHandler
::
report
(
DiagnosticsEngine
::
Level
level
,
StringRef
message
,
SourceLocation
loc
)
{
return
Plugin
::
report
(
level
,
message
,
context
,
loc
);
}
void
PluginHandler
::
HandleTranslationUnit
(
ASTContext
&
context
)
{
if
(
context
.
getDiagnostics
().
hasErrorOccurred
())
...
...
@@ -103,7 +105,6 @@ void PluginHandler::HandleTranslationUnit( ASTContext& context )
++
it
)
{
const
FileEntry
*
e
=
context
.
getSourceManager
().
getFileEntryForID
(
it
->
first
);
DiagnosticsEngine
&
diag
=
context
.
getDiagnostics
();
/* Check where the file actually is, and warn about cases where modification
most probably doesn't matter (generated files in workdir).
The order here is important, as OUTDIR and WORKDIR are often in SRCDIR/BUILDDIR,
...
...
@@ -125,21 +126,18 @@ void PluginHandler::HandleTranslationUnit( ASTContext& context )
}
}
if
(
modifyFile
.
empty
())
diag
.
Report
(
diag
.
getCustomDiagID
(
DiagnosticsEngine
::
Warning
,
"modified source in solver/ : %0 [loplugin]"
))
<<
e
->
getName
();
report
(
DiagnosticsEngine
::
Warning
,
"modified source in solver/ : %0 [loplugin]"
)
<<
e
->
getName
();
}
else
if
(
strncmp
(
e
->
getName
(),
WORKDIR
,
strlen
(
WORKDIR
))
==
0
)
diag
.
Report
(
diag
.
getCustomDiagID
(
DiagnosticsEngine
::
Warning
,
"modified source in workdir/ : %0 [loplugin]"
))
<<
e
->
getName
();
report
(
DiagnosticsEngine
::
Warning
,
"modified source in workdir/ : %0 [loplugin]"
)
<<
e
->
getName
();
else
if
(
strcmp
(
SRCDIR
,
BUILDDIR
)
!=
0
&&
strncmp
(
e
->
getName
(),
BUILDDIR
,
strlen
(
BUILDDIR
))
==
0
)
diag
.
Report
(
diag
.
getCustomDiagID
(
DiagnosticsEngine
::
Warning
,
"modified source in build dir : %0 [loplugin]"
))
<<
e
->
getName
();
report
(
DiagnosticsEngine
::
Warning
,
"modified source in build dir : %0 [loplugin]"
)
<<
e
->
getName
();
else
if
(
strncmp
(
e
->
getName
(),
SRCDIR
,
strlen
(
SRCDIR
))
==
0
)
;
// ok
else
{
diag
.
Report
(
diag
.
getCustomDiagID
(
DiagnosticsEngine
::
Warning
,
"modified source in unknown location, not modifying : %0 [loplugin]"
))
<<
e
->
getName
();
report
(
DiagnosticsEngine
::
Warning
,
"modified source in unknown location, not modifying : %0 [loplugin]"
)
<<
e
->
getName
();
continue
;
// --->
}
if
(
modifyFile
.
empty
())
...
...
@@ -159,8 +157,7 @@ void PluginHandler::HandleTranslationUnit( ASTContext& context )
ostream
.
clear_error
();
unlink
(
filename
);
if
(
!
ok
)
diag
.
Report
(
diag
.
getCustomDiagID
(
DiagnosticsEngine
::
Error
,
"cannot write modified source to %0 (%1) [loplugin]"
))
<<
modifyFile
<<
error
;
report
(
DiagnosticsEngine
::
Error
,
"cannot write modified source to %0 (%1) [loplugin]"
)
<<
modifyFile
<<
error
;
delete
[]
filename
;
}
}
...
...
compilerplugins/clang/pluginhandler.hxx
Dosyayı görüntüle @
b4392c57
...
...
@@ -31,6 +31,8 @@ class PluginHandler
virtual
void
HandleTranslationUnit
(
ASTContext
&
context
);
static
void
registerPlugin
(
Plugin
*
(
*
create
)(
ASTContext
&
,
Rewriter
&
),
const
char
*
optionName
,
bool
isRewriter
);
private
:
DiagnosticBuilder
report
(
DiagnosticsEngine
::
Level
level
,
StringRef
message
,
SourceLocation
loc
=
SourceLocation
());
ASTContext
&
context
;
Rewriter
rewriter
;
};
...
...
compilerplugins/clang/postfixincrementfix.cxx
Dosyayı görüntüle @
b4392c57
...
...
@@ -119,10 +119,8 @@ bool PostfixIncrementFix::canChangePostfixToPrefix( const CXXOperatorCallExpr* o
return
canChangeInConditionStatement
(
op
,
dyn_cast
<
ForStmt
>
(
parents
[
parent_pos
]
)
->
getCond
(),
parents
,
parent_pos
);
default
:
DiagnosticsEngine
&
diag
=
context
.
getDiagnostics
();
unsigned
diagid
=
diag
.
getCustomDiagID
(
DiagnosticsEngine
::
Fatal
,
"cannot analyze operator++ (plugin needs fixing) [loplugin]"
);
diag
.
Report
(
op
->
getLocStart
(),
diagid
)
<<
parents
[
parent_pos
]
->
getSourceRange
();
report
(
DiagnosticsEngine
::
Fatal
,
"cannot analyze operator++ (plugin needs fixing) [loplugin]"
,
op
->
getLocStart
())
<<
parents
[
parent_pos
]
->
getSourceRange
();
// parents[ parent_pos ]->dump();
// parents[ std::max( parent_pos - 3, 0 ) ]->dump();
return
false
;
...
...
@@ -157,10 +155,8 @@ bool PostfixIncrementFix::shouldDoChange( const Expr* operand )
return
true
;
default
:
{
DiagnosticsEngine
&
diag
=
context
.
getDiagnostics
();
unsigned
diagid
=
diag
.
getCustomDiagID
(
DiagnosticsEngine
::
Fatal
,
"cannot analyze operator++ (plugin needs fixing) [loplugin]"
);
diag
.
Report
(
expr
->
getLocStart
(),
diagid
)
<<
operand
->
getSourceRange
();
report
(
DiagnosticsEngine
::
Fatal
,
"cannot analyze operator++ (plugin needs fixing) [loplugin]"
,
expr
->
getLocStart
())
<<
operand
->
getSourceRange
();
expr
->
dump
();
operand
->
dump
();
return
false
;
...
...
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