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
5646906f
Kaydet (Commit)
5646906f
authored
Eki 26, 2012
tarafından
Luboš Luňák
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
do not warn about missing area in SAL_DEBUG
Change-Id: I99314136cac7f47a5adf8e0e29093ec9fbf4fd90
üst
0956d263
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
3 deletions
+19
-3
sallogareas.cxx
compilerplugins/clang/sallogareas.cxx
+19
-3
No files found.
compilerplugins/clang/sallogareas.cxx
Dosyayı görüntüle @
5646906f
...
...
@@ -11,6 +11,7 @@
#include "sallogareas.hxx"
#include <clang/Basic/SourceManager.h>
#include <clang/Lex/Lexer.h>
#include <fstream>
...
...
@@ -53,16 +54,16 @@ bool SalLogAreas::VisitCallExpr( CallExpr* call )
{
string
qualifiedName
=
func
->
getQualifiedNameAsString
();
if
(
qualifiedName
==
"sal_detail_log"
||
qualifiedName
==
"sal::detail::log"
)
{
if
(
const
StringLiteral
*
area
=
dyn_cast
<
StringLiteral
>
(
call
->
getArg
(
1
)
->
IgnoreParenImpCasts
()))
{
// The SAL_DETAIL_LOG_STREAM macro expands to two calls to sal::detail::log(),
// so do not warn repeatedly about the same macro (the area->getLocStart() of all the calls
// from the same macro should be the same).
SourceLocation
expansionLocation
=
context
.
getSourceManager
().
getExpansionLoc
(
area
->
getLocStart
());
SourceLocation
expansionLocation
=
context
.
getSourceManager
().
getExpansionLoc
(
call
->
getLocStart
());
if
(
expansionLocation
==
lastSalDetailLogStreamMacro
)
return
true
;
lastSalDetailLogStreamMacro
=
expansionLocation
;
if
(
const
StringLiteral
*
area
=
dyn_cast
<
StringLiteral
>
(
call
->
getArg
(
1
)
->
IgnoreParenImpCasts
()))
{
if
(
area
->
getKind
()
==
StringLiteral
::
Ascii
)
checkArea
(
area
->
getBytes
(),
area
->
getExprLoc
());
else
...
...
@@ -72,6 +73,21 @@ bool SalLogAreas::VisitCallExpr( CallExpr* call )
}
if
(
inFunction
->
getQualifiedNameAsString
()
==
"sal::detail::log"
)
return
true
;
// This function only forwards to sal_detail_log, so ok.
if
(
call
->
getArg
(
1
)
->
isNullPointerConstant
(
context
,
Expr
::
NPC_ValueDependentIsNotNull
)
!=
Expr
::
NPCK_NotNull
)
{
// If the area argument is a null pointer, that is allowed only for SAL_DEBUG.
const
SourceManager
&
source
=
context
.
getSourceManager
();
for
(
SourceLocation
loc
=
call
->
getLocStart
();
loc
.
isMacroID
();
loc
=
source
.
getImmediateExpansionRange
(
loc
).
first
)
{
StringRef
inMacro
=
Lexer
::
getImmediateMacroName
(
loc
,
source
,
context
.
getLangOpts
());
if
(
inMacro
==
"SAL_DEBUG"
)
return
true
;
// ok
}
report
(
DiagnosticsEngine
::
Warning
,
"missing log area [loplugin]"
,
call
->
getArg
(
1
)
->
IgnoreParenImpCasts
()
->
getLocStart
());
return
true
;
}
report
(
DiagnosticsEngine
::
Warning
,
"cannot analyse log area argument (plugin needs fixing?) [loplugin]"
,
call
->
getLocStart
());
}
...
...
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