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
1084e8be
Kaydet (Commit)
1084e8be
authored
Eki 04, 2017
tarafından
Stephan Bergmann
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
More targeted check for preprocessing conditionals in loplugin:blockblock
Change-Id: Ib9b6b266ed4bf4d2672aed723c7f92f58c9007b3
üst
f4514f35
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
45 deletions
+8
-45
blockblock.cxx
compilerplugins/clang/blockblock.cxx
+3
-42
blockblock.cxx
compilerplugins/clang/test/blockblock.cxx
+5
-3
No files found.
compilerplugins/clang/blockblock.cxx
Dosyayı görüntüle @
1084e8be
...
...
@@ -35,48 +35,6 @@ public:
TraverseDecl
(
compiler
.
getASTContext
().
getTranslationUnitDecl
());
}
bool
TraverseFunctionDecl
(
FunctionDecl
*
decl
)
{
if
(
containsPreprocessingConditionalInclusion
(
decl
->
getSourceRange
()))
{
return
true
;
}
return
RecursiveASTVisitor
::
TraverseFunctionDecl
(
decl
);
}
bool
TraverseCXXMethodDecl
(
CXXMethodDecl
*
decl
)
{
if
(
containsPreprocessingConditionalInclusion
(
decl
->
getSourceRange
()))
{
return
true
;
}
return
RecursiveASTVisitor
::
TraverseCXXMethodDecl
(
decl
);
}
bool
TraverseCXXConstructorDecl
(
CXXConstructorDecl
*
decl
)
{
if
(
containsPreprocessingConditionalInclusion
(
decl
->
getSourceRange
()))
{
return
true
;
}
return
RecursiveASTVisitor
::
TraverseCXXConstructorDecl
(
decl
);
}
bool
TraverseCXXDestructorDecl
(
CXXDestructorDecl
*
decl
)
{
if
(
containsPreprocessingConditionalInclusion
(
decl
->
getSourceRange
()))
{
return
true
;
}
return
RecursiveASTVisitor
::
TraverseCXXDestructorDecl
(
decl
);
}
bool
TraverseCXXConversionDecl
(
CXXConversionDecl
*
decl
)
{
if
(
containsPreprocessingConditionalInclusion
(
decl
->
getSourceRange
()))
{
return
true
;
}
return
RecursiveASTVisitor
::
TraverseCXXConversionDecl
(
decl
);
}
bool
TraverseObjCMethodDecl
(
ObjCMethodDecl
*
decl
)
{
if
(
containsPreprocessingConditionalInclusion
(
decl
->
getSourceRange
()))
{
return
true
;
}
return
RecursiveASTVisitor
::
TraverseObjCMethodDecl
(
decl
);
}
bool
VisitCompoundStmt
(
CompoundStmt
const
*
);
};
...
...
@@ -93,6 +51,9 @@ bool BlockBlock::VisitCompoundStmt(CompoundStmt const * compound)
return
true
;
if
(
compiler
.
getSourceManager
().
isMacroBodyExpansion
(
inner
->
getLocStart
()))
return
true
;
if
(
containsPreprocessingConditionalInclusion
(
compound
->
getSourceRange
()))
{
return
true
;
}
report
(
DiagnosticsEngine
::
Warning
,
"block directly inside block"
,
...
...
compilerplugins/clang/test/blockblock.cxx
Dosyayı görüntüle @
1084e8be
...
...
@@ -8,12 +8,14 @@
*/
int
f
(
bool
b1
,
bool
b2
)
{
if
(
b1
||
b2
)
{
if
(
b1
||
b2
)
{
// no warning
#if 0
if (b1)
#endif
{
return
0
;
{
// expected-error {{block directly inside block [loplugin:blockblock]}}
{
// expected-note {{inner block here [loplugin:blockblock]}}
return
0
;
}
}
}
return
1
;
...
...
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