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
1ce7176b
Kaydet (Commit)
1ce7176b
authored
Haz 29, 2016
tarafından
Stephan Bergmann
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Remove support for Clang < 3.3
Change-Id: I185852a738bac10dc6d331afccfcbc7ae1225cb1
üst
6439d93c
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
29 additions
and
155 deletions
+29
-155
checkconfigmacros.cxx
compilerplugins/clang/checkconfigmacros.cxx
+4
-26
compat.hxx
compilerplugins/clang/compat.hxx
+0
-56
externandnotdefined.cxx
compilerplugins/clang/externandnotdefined.cxx
+1
-1
implicitboolconversion.cxx
compilerplugins/clang/implicitboolconversion.cxx
+0
-6
literaltoboolconversion.cxx
compilerplugins/clang/literaltoboolconversion.cxx
+1
-1
nullptr.cxx
compilerplugins/clang/nullptr.cxx
+5
-14
redundantcast.cxx
compilerplugins/clang/redundantcast.cxx
+4
-4
salbool.cxx
compilerplugins/clang/salbool.cxx
+5
-25
constantfunction.cxx
compilerplugins/clang/store/constantfunction.cxx
+1
-1
rtlconstasciimacro.cxx
compilerplugins/clang/store/rtlconstasciimacro.cxx
+0
-8
stringconstant.cxx
compilerplugins/clang/stringconstant.cxx
+4
-3
unreffun.cxx
compilerplugins/clang/unreffun.cxx
+4
-10
No files found.
compilerplugins/clang/checkconfigmacros.cxx
Dosyayı görüntüle @
1ce7176b
...
@@ -34,13 +34,6 @@ class CheckConfigMacros
...
@@ -34,13 +34,6 @@ class CheckConfigMacros
public
:
public
:
explicit
CheckConfigMacros
(
const
InstantiationData
&
data
);
explicit
CheckConfigMacros
(
const
InstantiationData
&
data
);
virtual
void
run
()
override
;
virtual
void
run
()
override
;
#if CLANG_VERSION < 30300
virtual
void
MacroDefined
(
const
Token
&
macroToken
,
const
MacroInfo
*
info
)
override
;
virtual
void
MacroUndefined
(
const
Token
&
macroToken
,
const
MacroInfo
*
info
)
override
;
virtual
void
Ifdef
(
SourceLocation
location
,
const
Token
&
macroToken
)
override
;
virtual
void
Ifndef
(
SourceLocation
location
,
const
Token
&
macroToken
)
override
;
virtual
void
Defined
(
const
Token
&
macroToken
)
override
;
#else
virtual
void
MacroDefined
(
const
Token
&
macroToken
,
const
MacroDirective
*
info
)
override
;
virtual
void
MacroDefined
(
const
Token
&
macroToken
,
const
MacroDirective
*
info
)
override
;
#if CLANG_VERSION < 30700
#if CLANG_VERSION < 30700
virtual
void
MacroUndefined
(
const
Token
&
macroToken
,
const
MacroDirective
*
info
)
override
;
virtual
void
MacroUndefined
(
const
Token
&
macroToken
,
const
MacroDirective
*
info
)
override
;
...
@@ -57,7 +50,6 @@ class CheckConfigMacros
...
@@ -57,7 +50,6 @@ class CheckConfigMacros
virtual
void
Defined
(
const
Token
&
macroToken
,
const
MacroDirective
*
info
,
SourceRange
Range
)
override
;
virtual
void
Defined
(
const
Token
&
macroToken
,
const
MacroDirective
*
info
,
SourceRange
Range
)
override
;
#else
#else
virtual
void
Defined
(
const
Token
&
macroToken
,
const
MacroDefinition
&
info
,
SourceRange
Range
)
override
;
virtual
void
Defined
(
const
Token
&
macroToken
,
const
MacroDefinition
&
info
,
SourceRange
Range
)
override
;
#endif
#endif
#endif
enum
{
isPPCallback
=
true
};
enum
{
isPPCallback
=
true
};
private
:
private
:
...
@@ -76,15 +68,9 @@ void CheckConfigMacros::run()
...
@@ -76,15 +68,9 @@ void CheckConfigMacros::run()
// nothing, only check preprocessor usage
// nothing, only check preprocessor usage
}
}
#if CLANG_VERSION < 30300
void
CheckConfigMacros
::
MacroDefined
(
const
Token
&
macroToken
,
const
MacroInfo
*
info
)
{
SourceLocation
location
=
info
->
getDefinitionLoc
();
#else
void
CheckConfigMacros
::
MacroDefined
(
const
Token
&
macroToken
,
const
MacroDirective
*
info
)
void
CheckConfigMacros
::
MacroDefined
(
const
Token
&
macroToken
,
const
MacroDirective
*
info
)
{
{
SourceLocation
location
=
info
->
getLocation
();
SourceLocation
location
=
info
->
getLocation
();
#endif
const
char
*
filename
=
compiler
.
getSourceManager
().
getPresumedLoc
(
location
).
getFilename
();
const
char
*
filename
=
compiler
.
getSourceManager
().
getPresumedLoc
(
location
).
getFilename
();
if
(
filename
!=
NULL
if
(
filename
!=
NULL
&&
(
strncmp
(
filename
,
BUILDDIR
"/config_host/"
,
strlen
(
BUILDDIR
"/config_host/"
))
==
0
&&
(
strncmp
(
filename
,
BUILDDIR
"/config_host/"
,
strlen
(
BUILDDIR
"/config_host/"
))
==
0
...
@@ -95,9 +81,7 @@ void CheckConfigMacros::MacroDefined( const Token& macroToken, const MacroDirect
...
@@ -95,9 +81,7 @@ void CheckConfigMacros::MacroDefined( const Token& macroToken, const MacroDirect
}
}
}
}
#if CLANG_VERSION < 30300
#if CLANG_VERSION < 30700
void
CheckConfigMacros
::
MacroUndefined
(
const
Token
&
macroToken
,
const
MacroInfo
*
)
#elif CLANG_VERSION < 30700
void
CheckConfigMacros
::
MacroUndefined
(
const
Token
&
macroToken
,
const
MacroDirective
*
)
void
CheckConfigMacros
::
MacroUndefined
(
const
Token
&
macroToken
,
const
MacroDirective
*
)
#else
#else
void
CheckConfigMacros
::
MacroUndefined
(
const
Token
&
macroToken
,
const
MacroDefinition
&
)
void
CheckConfigMacros
::
MacroUndefined
(
const
Token
&
macroToken
,
const
MacroDefinition
&
)
...
@@ -106,9 +90,7 @@ void CheckConfigMacros::MacroUndefined( const Token& macroToken, const MacroDefi
...
@@ -106,9 +90,7 @@ void CheckConfigMacros::MacroUndefined( const Token& macroToken, const MacroDefi
configMacros
.
erase
(
macroToken
.
getIdentifierInfo
()
->
getName
());
configMacros
.
erase
(
macroToken
.
getIdentifierInfo
()
->
getName
());
}
}
#if CLANG_VERSION < 30300
#if CLANG_VERSION < 30700
void
CheckConfigMacros
::
Ifdef
(
SourceLocation
location
,
const
Token
&
macroToken
)
#elif CLANG_VERSION < 30700
void
CheckConfigMacros
::
Ifdef
(
SourceLocation
location
,
const
Token
&
macroToken
,
const
MacroDirective
*
)
void
CheckConfigMacros
::
Ifdef
(
SourceLocation
location
,
const
Token
&
macroToken
,
const
MacroDirective
*
)
#else
#else
void
CheckConfigMacros
::
Ifdef
(
SourceLocation
location
,
const
Token
&
macroToken
,
const
MacroDefinition
&
)
void
CheckConfigMacros
::
Ifdef
(
SourceLocation
location
,
const
Token
&
macroToken
,
const
MacroDefinition
&
)
...
@@ -117,9 +99,7 @@ void CheckConfigMacros::Ifdef( SourceLocation location, const Token& macroToken,
...
@@ -117,9 +99,7 @@ void CheckConfigMacros::Ifdef( SourceLocation location, const Token& macroToken,
checkMacro
(
macroToken
,
location
);
checkMacro
(
macroToken
,
location
);
}
}
#if CLANG_VERSION < 30300
#if CLANG_VERSION < 30700
void
CheckConfigMacros
::
Ifndef
(
SourceLocation
location
,
const
Token
&
macroToken
)
#elif CLANG_VERSION < 30700
void
CheckConfigMacros
::
Ifndef
(
SourceLocation
location
,
const
Token
&
macroToken
,
const
MacroDirective
*
)
void
CheckConfigMacros
::
Ifndef
(
SourceLocation
location
,
const
Token
&
macroToken
,
const
MacroDirective
*
)
#else
#else
void
CheckConfigMacros
::
Ifndef
(
SourceLocation
location
,
const
Token
&
macroToken
,
const
MacroDefinition
&
)
void
CheckConfigMacros
::
Ifndef
(
SourceLocation
location
,
const
Token
&
macroToken
,
const
MacroDefinition
&
)
...
@@ -128,9 +108,7 @@ void CheckConfigMacros::Ifndef( SourceLocation location, const Token& macroToken
...
@@ -128,9 +108,7 @@ void CheckConfigMacros::Ifndef( SourceLocation location, const Token& macroToken
checkMacro
(
macroToken
,
location
);
checkMacro
(
macroToken
,
location
);
}
}
#if CLANG_VERSION < 30300
#if CLANG_VERSION < 30400
void
CheckConfigMacros
::
Defined
(
const
Token
&
macroToken
)
#elif CLANG_VERSION < 30400
void
CheckConfigMacros
::
Defined
(
const
Token
&
macroToken
,
const
MacroDirective
*
)
void
CheckConfigMacros
::
Defined
(
const
Token
&
macroToken
,
const
MacroDirective
*
)
#elif CLANG_VERSION < 30700
#elif CLANG_VERSION < 30700
void
CheckConfigMacros
::
Defined
(
const
Token
&
macroToken
,
const
MacroDirective
*
,
SourceRange
)
void
CheckConfigMacros
::
Defined
(
const
Token
&
macroToken
,
const
MacroDirective
*
,
SourceRange
)
...
...
compilerplugins/clang/compat.hxx
Dosyayı görüntüle @
1ce7176b
...
@@ -90,28 +90,6 @@ inline bool forallBases(
...
@@ -90,28 +90,6 @@ inline bool forallBases(
#endif
#endif
}
}
#if CLANG_VERSION >= 30300
typedef
clang
::
LinkageInfo
LinkageInfo
;
#else
typedef
clang
::
NamedDecl
::
LinkageInfo
LinkageInfo
;
#endif
inline
clang
::
Linkage
getLinkage
(
LinkageInfo
const
&
info
)
{
#if CLANG_VERSION >= 30300
return
info
.
getLinkage
();
#else
return
info
.
linkage
();
#endif
}
inline
clang
::
Visibility
getVisibility
(
LinkageInfo
const
&
info
)
{
#if CLANG_VERSION >= 30300
return
info
.
getVisibility
();
#else
return
info
.
visibility
();
#endif
}
inline
bool
isFirstDecl
(
clang
::
FunctionDecl
const
&
decl
)
{
inline
bool
isFirstDecl
(
clang
::
FunctionDecl
const
&
decl
)
{
#if CLANG_VERSION >= 30400
#if CLANG_VERSION >= 30400
return
decl
.
isFirstDecl
();
return
decl
.
isFirstDecl
();
...
@@ -251,30 +229,6 @@ inline std::unique_ptr<llvm::raw_fd_ostream> create_raw_fd_ostream(
...
@@ -251,30 +229,6 @@ inline std::unique_ptr<llvm::raw_fd_ostream> create_raw_fd_ostream(
#endif
#endif
}
}
#if CLANG_VERSION >= 30700
typedef
clang
::
DeclContext
::
lookup_result
DeclContextLookupResult
;
typedef
clang
::
DeclContext
::
lookup_iterator
DeclContextLookupIterator
;
#else
typedef
clang
::
DeclContext
::
lookup_const_result
DeclContextLookupResult
;
typedef
clang
::
DeclContext
::
lookup_const_iterator
DeclContextLookupIterator
;
#endif
inline
DeclContextLookupIterator
begin
(
DeclContextLookupResult
const
&
result
)
{
#if CLANG_VERSION >= 30300
return
result
.
begin
();
#else
return
result
.
first
;
#endif
}
inline
DeclContextLookupIterator
end
(
DeclContextLookupResult
const
&
result
)
{
#if CLANG_VERSION >= 30300
return
result
.
end
();
#else
return
result
.
second
;
#endif
}
inline
void
addPPCallbacks
(
inline
void
addPPCallbacks
(
clang
::
Preprocessor
&
preprocessor
,
clang
::
PPCallbacks
*
C
)
clang
::
Preprocessor
&
preprocessor
,
clang
::
PPCallbacks
*
C
)
{
{
...
@@ -303,16 +257,6 @@ inline bool isMacroArgExpansion(
...
@@ -303,16 +257,6 @@ inline bool isMacroArgExpansion(
#endif
#endif
}
}
inline
bool
isMacroBodyExpansion
(
clang
::
CompilerInstance
&
compiler
,
clang
::
SourceLocation
location
)
{
#if CLANG_VERSION >= 30300
return
compiler
.
getSourceManager
().
isMacroBodyExpansion
(
location
);
#else
return
location
.
isMacroID
()
&&
!
compiler
.
getSourceManager
().
isMacroArgExpansion
(
location
);
#endif
}
inline
auto
getAsTagDecl
(
clang
::
Type
const
&
t
)
->
clang
::
TagDecl
*
inline
auto
getAsTagDecl
(
clang
::
Type
const
&
t
)
->
clang
::
TagDecl
*
{
{
#if CLANG_VERSION >= 30500
#if CLANG_VERSION >= 30500
...
...
compilerplugins/clang/externandnotdefined.cxx
Dosyayı görüntüle @
1ce7176b
...
@@ -33,7 +33,7 @@ bool ExternAndNotDefined::VisitFunctionDecl(const FunctionDecl * functionDecl) {
...
@@ -33,7 +33,7 @@ bool ExternAndNotDefined::VisitFunctionDecl(const FunctionDecl * functionDecl) {
return
true
;
return
true
;
}
}
if
(
functionDecl
->
isDefined
()
||
functionDecl
->
isPure
()
if
(
functionDecl
->
isDefined
()
||
functionDecl
->
isPure
()
||
(
compat
::
getLinkage
(
functionDecl
->
getLinkageAndVisibility
()
)
||
(
functionDecl
->
getLinkageAndVisibility
().
getLinkage
(
)
!=
ExternalLinkage
))
{
!=
ExternalLinkage
))
{
return
true
;
return
true
;
}
}
...
...
compilerplugins/clang/implicitboolconversion.cxx
Dosyayı görüntüle @
1ce7176b
...
@@ -224,15 +224,9 @@ bool hasCLanguageLinkageType(FunctionDecl const * decl) {
...
@@ -224,15 +224,9 @@ bool hasCLanguageLinkageType(FunctionDecl const * decl) {
if
(
decl
->
isExternC
())
{
if
(
decl
->
isExternC
())
{
return
true
;
return
true
;
}
}
#if CLANG_VERSION >= 30300
if
(
decl
->
isInExternCContext
())
{
if
(
decl
->
isInExternCContext
())
{
return
true
;
return
true
;
}
}
#else
if
(
decl
->
getCanonicalDecl
()
->
getDeclContext
()
->
isExternCContext
())
{
return
true
;
}
#endif
return
false
;
return
false
;
}
}
...
...
compilerplugins/clang/literaltoboolconversion.cxx
Dosyayı görüntüle @
1ce7176b
...
@@ -93,7 +93,7 @@ void LiteralToBoolConversion::handleImplicitCastSubExpr(
...
@@ -93,7 +93,7 @@ void LiteralToBoolConversion::handleImplicitCastSubExpr(
while
(
compiler
.
getSourceManager
().
isMacroArgExpansion
(
loc
))
{
while
(
compiler
.
getSourceManager
().
isMacroArgExpansion
(
loc
))
{
loc
=
compiler
.
getSourceManager
().
getImmediateMacroCallerLoc
(
loc
);
loc
=
compiler
.
getSourceManager
().
getImmediateMacroCallerLoc
(
loc
);
}
}
if
(
comp
at
::
isMacroBodyExpansion
(
compiler
,
loc
))
{
if
(
comp
iler
.
getSourceManager
().
isMacroBodyExpansion
(
loc
))
{
StringRef
name
{
Lexer
::
getImmediateMacroName
(
StringRef
name
{
Lexer
::
getImmediateMacroName
(
loc
,
compiler
.
getSourceManager
(),
compiler
.
getLangOpts
())
};
loc
,
compiler
.
getSourceManager
(),
compiler
.
getLangOpts
())
};
if
(
name
==
"sal_False"
||
name
==
"sal_True"
)
{
if
(
name
==
"sal_False"
||
name
==
"sal_True"
)
{
...
...
compilerplugins/clang/nullptr.cxx
Dosyayı görüntüle @
1ce7176b
...
@@ -67,8 +67,6 @@ private:
...
@@ -67,8 +67,6 @@ private:
bool
isFromCIncludeFile
(
SourceLocation
spellingLocation
)
const
;
bool
isFromCIncludeFile
(
SourceLocation
spellingLocation
)
const
;
bool
isMacroBodyExpansion
(
SourceLocation
location
)
const
;
void
visitCXXCtorInitializer
(
CXXCtorInitializer
const
*
init
);
void
visitCXXCtorInitializer
(
CXXCtorInitializer
const
*
init
);
void
handleZero
(
Expr
const
*
expr
);
void
handleZero
(
Expr
const
*
expr
);
...
@@ -218,15 +216,6 @@ bool Nullptr::isFromCIncludeFile(SourceLocation spellingLocation) const {
...
@@ -218,15 +216,6 @@ bool Nullptr::isFromCIncludeFile(SourceLocation spellingLocation) const {
.
endswith
(
".h"
));
.
endswith
(
".h"
));
}
}
bool
Nullptr
::
isMacroBodyExpansion
(
SourceLocation
location
)
const
{
#if CLANG_VERSION >= 30300
return
compiler
.
getSourceManager
().
isMacroBodyExpansion
(
location
);
#else
return
location
.
isMacroID
()
&&
!
compiler
.
getSourceManager
().
isMacroArgExpansion
(
location
);
#endif
}
void
Nullptr
::
visitCXXCtorInitializer
(
CXXCtorInitializer
const
*
init
)
{
void
Nullptr
::
visitCXXCtorInitializer
(
CXXCtorInitializer
const
*
init
)
{
if
(
!
init
->
isWritten
())
{
if
(
!
init
->
isWritten
())
{
return
;
return
;
...
@@ -273,7 +262,7 @@ void Nullptr::handleNull(
...
@@ -273,7 +262,7 @@ void Nullptr::handleNull(
while
(
compiler
.
getSourceManager
().
isMacroArgExpansion
(
loc
))
{
while
(
compiler
.
getSourceManager
().
isMacroArgExpansion
(
loc
))
{
loc
=
compiler
.
getSourceManager
().
getImmediateMacroCallerLoc
(
loc
);
loc
=
compiler
.
getSourceManager
().
getImmediateMacroCallerLoc
(
loc
);
}
}
if
(
isMacroBodyExpansion
(
loc
))
{
if
(
compiler
.
getSourceManager
().
isMacroBodyExpansion
(
loc
))
{
if
(
Lexer
::
getImmediateMacroName
(
if
(
Lexer
::
getImmediateMacroName
(
loc
,
compiler
.
getSourceManager
(),
compiler
.
getLangOpts
())
loc
,
compiler
.
getSourceManager
(),
compiler
.
getLangOpts
())
==
"NULL"
)
==
"NULL"
)
...
@@ -336,7 +325,8 @@ void Nullptr::rewriteOrWarn(
...
@@ -336,7 +325,8 @@ void Nullptr::rewriteOrWarn(
locStart
=
compiler
.
getSourceManager
()
locStart
=
compiler
.
getSourceManager
()
.
getImmediateMacroCallerLoc
(
locStart
);
.
getImmediateMacroCallerLoc
(
locStart
);
}
}
if
(
compiler
.
getLangOpts
().
CPlusPlus
&&
isMacroBodyExpansion
(
locStart
)
if
(
compiler
.
getLangOpts
().
CPlusPlus
&&
compiler
.
getSourceManager
().
isMacroBodyExpansion
(
locStart
)
&&
(
Lexer
::
getImmediateMacroName
(
&&
(
Lexer
::
getImmediateMacroName
(
locStart
,
compiler
.
getSourceManager
(),
locStart
,
compiler
.
getSourceManager
(),
compiler
.
getLangOpts
())
compiler
.
getLangOpts
())
...
@@ -350,7 +340,8 @@ void Nullptr::rewriteOrWarn(
...
@@ -350,7 +340,8 @@ void Nullptr::rewriteOrWarn(
locEnd
=
compiler
.
getSourceManager
()
locEnd
=
compiler
.
getSourceManager
()
.
getImmediateMacroCallerLoc
(
locEnd
);
.
getImmediateMacroCallerLoc
(
locEnd
);
}
}
if
(
compiler
.
getLangOpts
().
CPlusPlus
&&
isMacroBodyExpansion
(
locEnd
)
if
(
compiler
.
getLangOpts
().
CPlusPlus
&&
compiler
.
getSourceManager
().
isMacroBodyExpansion
(
locEnd
)
&&
(
Lexer
::
getImmediateMacroName
(
&&
(
Lexer
::
getImmediateMacroName
(
locEnd
,
compiler
.
getSourceManager
(),
locEnd
,
compiler
.
getSourceManager
(),
compiler
.
getLangOpts
())
compiler
.
getLangOpts
())
...
...
compilerplugins/clang/redundantcast.cxx
Dosyayı görüntüle @
1ce7176b
...
@@ -146,8 +146,8 @@ bool RedundantCast::VisitImplicitCastExpr(const ImplicitCastExpr * expr) {
...
@@ -146,8 +146,8 @@ bool RedundantCast::VisitImplicitCastExpr(const ImplicitCastExpr * expr) {
&&
isVoidPointer
(
&&
isVoidPointer
(
dyn_cast
<
CXXStaticCastExpr
>
(
e
)
->
getSubExpr
()
dyn_cast
<
CXXStaticCastExpr
>
(
e
)
->
getSubExpr
()
->
IgnoreParenImpCasts
()
->
getType
())
->
IgnoreParenImpCasts
()
->
getType
())
&&
!
comp
at
::
isMacroBodyExpansion
(
&&
!
comp
iler
.
getSourceManager
().
isMacroBodyExpansion
(
compiler
,
e
->
getLocStart
()))
e
->
getLocStart
()))
{
{
report
(
report
(
DiagnosticsEngine
::
Warning
,
DiagnosticsEngine
::
Warning
,
...
@@ -223,13 +223,13 @@ bool RedundantCast::VisitCXXReinterpretCastExpr(
...
@@ -223,13 +223,13 @@ bool RedundantCast::VisitCXXReinterpretCastExpr(
loc
=
compiler
.
getSourceManager
().
getImmediateMacroCallerLoc
(
loc
=
compiler
.
getSourceManager
().
getImmediateMacroCallerLoc
(
loc
);
loc
);
}
}
if
(
comp
at
::
isMacroBodyExpansion
(
compiler
,
loc
))
{
if
(
comp
iler
.
getSourceManager
().
isMacroBodyExpansion
(
loc
))
{
auto
loc2
=
expr
->
getLocEnd
();
auto
loc2
=
expr
->
getLocEnd
();
while
(
compiler
.
getSourceManager
().
isMacroArgExpansion
(
loc2
))
{
while
(
compiler
.
getSourceManager
().
isMacroArgExpansion
(
loc2
))
{
loc2
=
compiler
.
getSourceManager
()
loc2
=
compiler
.
getSourceManager
()
.
getImmediateMacroCallerLoc
(
loc2
);
.
getImmediateMacroCallerLoc
(
loc2
);
}
}
if
(
comp
at
::
isMacroBodyExpansion
(
compiler
,
loc2
))
{
if
(
comp
iler
.
getSourceManager
().
isMacroBodyExpansion
(
loc2
))
{
//TODO: check loc, loc2 are in same macro body expansion
//TODO: check loc, loc2 are in same macro body expansion
loc
=
compiler
.
getSourceManager
().
getSpellingLoc
(
loc
);
loc
=
compiler
.
getSourceManager
().
getSpellingLoc
(
loc
);
}
}
...
...
compilerplugins/clang/salbool.cxx
Dosyayı görüntüle @
1ce7176b
...
@@ -32,20 +32,6 @@ bool isSalBoolArray(QualType type) {
...
@@ -32,20 +32,6 @@ bool isSalBoolArray(QualType type) {
||
isSalBoolArray
(
t
->
getElementType
()));
||
isSalBoolArray
(
t
->
getElementType
()));
}
}
// Clang 3.2 FunctionDecl::isInlined doesn't work as advertised ("Determine
// whether this function should be inlined, because it is either marked 'inline'
// or 'constexpr' or is a member function of a class that was defined in the
// class body.") but mis-classifies salhelper::Timer's isTicking, isExpired, and
// expiresBefore members as defined in salhelper/source/timer.cxx as inlined:
bool
isInlined
(
FunctionDecl
const
&
decl
)
{
#if CLANG_VERSION >= 30300
return
decl
.
isInlined
();
#else
(
void
)
decl
;
return
false
;
#endif
}
// It appears that, given a function declaration, there is no way to determine
// It appears that, given a function declaration, there is no way to determine
// the language linkage of the function's type, only of the function's name
// the language linkage of the function's type, only of the function's name
// (via FunctionDecl::isExternC); however, in a case like
// (via FunctionDecl::isExternC); however, in a case like
...
@@ -61,15 +47,9 @@ bool hasCLanguageLinkageType(FunctionDecl const * decl) {
...
@@ -61,15 +47,9 @@ bool hasCLanguageLinkageType(FunctionDecl const * decl) {
if
(
decl
->
isExternC
())
{
if
(
decl
->
isExternC
())
{
return
true
;
return
true
;
}
}
#if CLANG_VERSION >= 30300
if
(
decl
->
isInExternCContext
())
{
if
(
decl
->
isInExternCContext
())
{
return
true
;
return
true
;
}
}
#else
if
(
decl
->
getCanonicalDecl
()
->
getDeclContext
()
->
isExternCContext
())
{
return
true
;
}
#endif
return
false
;
return
false
;
}
}
...
@@ -94,7 +74,7 @@ OverrideKind getOverrideKind(FunctionDecl const * decl) {
...
@@ -94,7 +74,7 @@ OverrideKind getOverrideKind(FunctionDecl const * decl) {
bool
hasBoolOverload
(
FunctionDecl
const
*
decl
,
bool
mustBeDeleted
)
{
bool
hasBoolOverload
(
FunctionDecl
const
*
decl
,
bool
mustBeDeleted
)
{
unsigned
n
=
decl
->
getNumParams
();
unsigned
n
=
decl
->
getNumParams
();
auto
res
=
decl
->
getDeclContext
()
->
lookup
(
decl
->
getDeclName
());
auto
res
=
decl
->
getDeclContext
()
->
lookup
(
decl
->
getDeclName
());
for
(
auto
d
=
compat
::
begin
(
res
);
d
!=
compat
::
end
(
res
);
++
d
)
{
for
(
auto
d
=
res
.
begin
();
d
!=
res
.
end
(
);
++
d
)
{
FunctionDecl
const
*
f
=
dyn_cast
<
FunctionDecl
>
(
*
d
);
FunctionDecl
const
*
f
=
dyn_cast
<
FunctionDecl
>
(
*
d
);
if
(
f
!=
nullptr
&&
(
!
mustBeDeleted
||
f
->
isDeleted
()))
{
if
(
f
!=
nullptr
&&
(
!
mustBeDeleted
||
f
->
isDeleted
()))
{
if
(
f
->
getNumParams
()
==
n
)
{
if
(
f
->
getNumParams
()
==
n
)
{
...
@@ -298,7 +278,7 @@ bool SalBool::VisitCStyleCastExpr(CStyleCastExpr * expr) {
...
@@ -298,7 +278,7 @@ bool SalBool::VisitCStyleCastExpr(CStyleCastExpr * expr) {
while
(
compiler
.
getSourceManager
().
isMacroArgExpansion
(
loc
))
{
while
(
compiler
.
getSourceManager
().
isMacroArgExpansion
(
loc
))
{
loc
=
compiler
.
getSourceManager
().
getImmediateMacroCallerLoc
(
loc
);
loc
=
compiler
.
getSourceManager
().
getImmediateMacroCallerLoc
(
loc
);
}
}
if
(
comp
at
::
isMacroBodyExpansion
(
compiler
,
loc
))
{
if
(
comp
iler
.
getSourceManager
().
isMacroBodyExpansion
(
loc
))
{
StringRef
name
{
Lexer
::
getImmediateMacroName
(
StringRef
name
{
Lexer
::
getImmediateMacroName
(
loc
,
compiler
.
getSourceManager
(),
compiler
.
getLangOpts
())
};
loc
,
compiler
.
getSourceManager
(),
compiler
.
getLangOpts
())
};
if
(
name
==
"sal_False"
||
name
==
"sal_True"
)
{
if
(
name
==
"sal_False"
||
name
==
"sal_True"
)
{
...
@@ -396,7 +376,7 @@ bool SalBool::VisitImplicitCastExpr(ImplicitCastExpr * expr) {
...
@@ -396,7 +376,7 @@ bool SalBool::VisitImplicitCastExpr(ImplicitCastExpr * expr) {
while
(
compiler
.
getSourceManager
().
isMacroArgExpansion
(
l
))
{
while
(
compiler
.
getSourceManager
().
isMacroArgExpansion
(
l
))
{
l
=
compiler
.
getSourceManager
().
getImmediateMacroCallerLoc
(
l
);
l
=
compiler
.
getSourceManager
().
getImmediateMacroCallerLoc
(
l
);
}
}
if
(
comp
at
::
isMacroBodyExpansion
(
compiler
,
l
))
{
if
(
comp
iler
.
getSourceManager
().
isMacroBodyExpansion
(
l
))
{
auto
n
=
Lexer
::
getImmediateMacroName
(
auto
n
=
Lexer
::
getImmediateMacroName
(
l
,
compiler
.
getSourceManager
(),
compiler
.
getLangOpts
());
l
,
compiler
.
getSourceManager
(),
compiler
.
getLangOpts
());
if
(
n
==
"sal_False"
||
n
==
"sal_True"
)
{
if
(
n
==
"sal_False"
||
n
==
"sal_True"
)
{
...
@@ -495,7 +475,7 @@ bool SalBool::VisitParmVarDecl(ParmVarDecl const * decl) {
...
@@ -495,7 +475,7 @@ bool SalBool::VisitParmVarDecl(ParmVarDecl const * decl) {
||
(
isInUnoIncludeFile
(
||
(
isInUnoIncludeFile
(
compiler
.
getSourceManager
().
getSpellingLoc
(
compiler
.
getSourceManager
().
getSpellingLoc
(
f
->
getNameInfo
().
getLoc
()))
f
->
getNameInfo
().
getLoc
()))
&&
(
!
isInlined
(
*
f
)
||
f
->
hasAttr
<
DeprecatedAttr
>
()
&&
(
!
f
->
isInlined
(
)
||
f
->
hasAttr
<
DeprecatedAttr
>
()
||
decl
->
getType
()
->
isReferenceType
()
||
decl
->
getType
()
->
isReferenceType
()
||
hasBoolOverload
(
f
,
false
)))
||
hasBoolOverload
(
f
,
false
)))
||
f
->
isDeleted
()
||
hasBoolOverload
(
f
,
true
)))
||
f
->
isDeleted
()
||
hasBoolOverload
(
f
,
true
)))
...
@@ -672,7 +652,7 @@ bool SalBool::VisitFunctionDecl(FunctionDecl const * decl) {
...
@@ -672,7 +652,7 @@ bool SalBool::VisitFunctionDecl(FunctionDecl const * decl) {
||
(
isInUnoIncludeFile
(
||
(
isInUnoIncludeFile
(
compiler
.
getSourceManager
().
getSpellingLoc
(
compiler
.
getSourceManager
().
getSpellingLoc
(
f
->
getNameInfo
().
getLoc
()))
f
->
getNameInfo
().
getLoc
()))
&&
(
!
isInlined
(
*
f
)
||
f
->
hasAttr
<
DeprecatedAttr
>
()))))
&&
(
!
f
->
isInlined
(
)
||
f
->
hasAttr
<
DeprecatedAttr
>
()))))
{
{
SourceLocation
loc
{
decl
->
getLocStart
()
};
SourceLocation
loc
{
decl
->
getLocStart
()
};
SourceLocation
l
{
compiler
.
getSourceManager
().
getExpansionLoc
(
SourceLocation
l
{
compiler
.
getSourceManager
().
getExpansionLoc
(
...
...
compilerplugins/clang/store/constantfunction.cxx
Dosyayı görüntüle @
1ce7176b
...
@@ -440,7 +440,7 @@ bool ConstantFunction::VisitFunctionDecl(const FunctionDecl * pFunctionDecl) {
...
@@ -440,7 +440,7 @@ bool ConstantFunction::VisitFunctionDecl(const FunctionDecl * pFunctionDecl) {
}
}
std
::
string
aImmediateMacro
=
""
;
std
::
string
aImmediateMacro
=
""
;
if
(
comp
at
::
isMacroBodyExpansion
(
compiler
,
pFunctionDecl
->
getLocStart
())
)
{
if
(
comp
iler
.
getSourceManager
().
isMacroBodyExpansion
(
pFunctionDecl
->
getLocStart
())
)
{
StringRef
name
{
Lexer
::
getImmediateMacroName
(
StringRef
name
{
Lexer
::
getImmediateMacroName
(
pFunctionDecl
->
getLocStart
(),
compiler
.
getSourceManager
(),
compiler
.
getLangOpts
())
};
pFunctionDecl
->
getLocStart
(),
compiler
.
getSourceManager
(),
compiler
.
getLangOpts
())
};
aImmediateMacro
=
name
;
aImmediateMacro
=
name
;
...
...
compilerplugins/clang/store/rtlconstasciimacro.cxx
Dosyayı görüntüle @
1ce7176b
...
@@ -34,12 +34,8 @@ class RtlConstAsciiMacro
...
@@ -34,12 +34,8 @@ class RtlConstAsciiMacro
bool
VisitCXXConstructExpr
(
CXXConstructExpr
*
expr
);
bool
VisitCXXConstructExpr
(
CXXConstructExpr
*
expr
);
bool
VisitCXXTemporaryObjectExpr
(
CXXTemporaryObjectExpr
*
expr
);
bool
VisitCXXTemporaryObjectExpr
(
CXXTemporaryObjectExpr
*
expr
);
bool
VisitStringLiteral
(
const
StringLiteral
*
literal
);
bool
VisitStringLiteral
(
const
StringLiteral
*
literal
);
#if CLANG_VERSION < 30300
virtual
void
MacroExpands
(
const
Token
&
macro
,
const
MacroInfo
*
info
,
SourceRange
range
)
override
;
#else
virtual
void
MacroExpands
(
const
Token
&
macro
,
const
MacroDirective
*
directive
,
virtual
void
MacroExpands
(
const
Token
&
macro
,
const
MacroDirective
*
directive
,
SourceRange
range
,
const
MacroArgs
*
args
)
override
;
SourceRange
range
,
const
MacroArgs
*
args
)
override
;
#endif
enum
{
isPPCallback
=
true
};
enum
{
isPPCallback
=
true
};
private
:
private
:
map
<
SourceLocation
,
SourceLocation
>
expansions
;
// start location -> end location
map
<
SourceLocation
,
SourceLocation
>
expansions
;
// start location -> end location
...
@@ -59,12 +55,8 @@ void RtlConstAsciiMacro::run()
...
@@ -59,12 +55,8 @@ void RtlConstAsciiMacro::run()
TraverseDecl
(
compiler
.
getASTContext
().
getTranslationUnitDecl
());
TraverseDecl
(
compiler
.
getASTContext
().
getTranslationUnitDecl
());
}
}
#if CLANG_VERSION < 30300
void
RtlConstAsciiMacro
::
MacroExpands
(
const
Token
&
macro
,
const
MacroInfo
*
,
SourceRange
range
)
#else
void
RtlConstAsciiMacro
::
MacroExpands
(
const
Token
&
macro
,
const
MacroDirective
*
,
void
RtlConstAsciiMacro
::
MacroExpands
(
const
Token
&
macro
,
const
MacroDirective
*
,
SourceRange
range
,
const
MacroArgs
*
)
SourceRange
range
,
const
MacroArgs
*
)
#endif
{
{
if
(
macro
.
getIdentifierInfo
()
->
getName
()
!=
"RTL_CONSTASCII_USTRINGPARAM"
)
if
(
macro
.
getIdentifierInfo
()
->
getName
()
!=
"RTL_CONSTASCII_USTRINGPARAM"
)
return
;
return
;
...
...
compilerplugins/clang/stringconstant.cxx
Dosyayı görüntüle @
1ce7176b
...
@@ -62,7 +62,7 @@ bool hasOverloads(FunctionDecl const * decl, unsigned arguments) {
...
@@ -62,7 +62,7 @@ bool hasOverloads(FunctionDecl const * decl, unsigned arguments) {
ctx
=
ctx
->
getParent
();
ctx
=
ctx
->
getParent
();
}
}
auto
res
=
ctx
->
lookup
(
decl
->
getDeclName
());
auto
res
=
ctx
->
lookup
(
decl
->
getDeclName
());
for
(
auto
d
=
compat
::
begin
(
res
);
d
!=
compat
::
end
(
res
);
++
d
)
{
for
(
auto
d
=
res
.
begin
();
d
!=
res
.
end
(
);
++
d
)
{
FunctionDecl
const
*
f
=
dyn_cast
<
FunctionDecl
>
(
*
d
);
FunctionDecl
const
*
f
=
dyn_cast
<
FunctionDecl
>
(
*
d
);
if
(
f
!=
nullptr
&&
f
->
getMinRequiredArguments
()
<=
arguments
if
(
f
!=
nullptr
&&
f
->
getMinRequiredArguments
()
<=
arguments
&&
f
->
getNumParams
()
>=
arguments
)
&&
f
->
getNumParams
()
>=
arguments
)
...
@@ -782,7 +782,8 @@ bool StringConstant::VisitCXXConstructExpr(CXXConstructExpr const * expr) {
...
@@ -782,7 +782,8 @@ bool StringConstant::VisitCXXConstructExpr(CXXConstructExpr const * expr) {
loc
=
compiler
.
getSourceManager
()
loc
=
compiler
.
getSourceManager
()
.
getImmediateMacroCallerLoc
(
loc
);
.
getImmediateMacroCallerLoc
(
loc
);
}
}
if
(
compat
::
isMacroBodyExpansion
(
compiler
,
loc
)
if
((
compiler
.
getSourceManager
()
.
isMacroBodyExpansion
(
loc
))
&&
(
Lexer
::
getImmediateMacroName
(
&&
(
Lexer
::
getImmediateMacroName
(
loc
,
compiler
.
getSourceManager
(),
loc
,
compiler
.
getSourceManager
(),
compiler
.
getLangOpts
())
compiler
.
getLangOpts
())
...
@@ -1119,7 +1120,7 @@ void StringConstant::reportChange(
...
@@ -1119,7 +1120,7 @@ void StringConstant::reportChange(
while
(
compiler
.
getSourceManager
().
isMacroArgExpansion
(
loc
))
{
while
(
compiler
.
getSourceManager
().
isMacroArgExpansion
(
loc
))
{
loc
=
compiler
.
getSourceManager
().
getImmediateMacroCallerLoc
(
loc
);
loc
=
compiler
.
getSourceManager
().
getImmediateMacroCallerLoc
(
loc
);
}
}
if
(
comp
at
::
isMacroBodyExpansion
(
compiler
,
loc
))
{
if
(
comp
iler
.
getSourceManager
().
isMacroBodyExpansion
(
loc
))
{
loc
=
compiler
.
getSourceManager
().
getSpellingLoc
(
loc
);
loc
=
compiler
.
getSourceManager
().
getSpellingLoc
(
loc
);
}
}
unsigned
n
=
Lexer
::
MeasureTokenLength
(
unsigned
n
=
Lexer
::
MeasureTokenLength
(
...
...
compilerplugins/clang/unreffun.cxx
Dosyayı görüntüle @
1ce7176b
...
@@ -33,15 +33,9 @@ bool hasCLanguageLinkageType(FunctionDecl const * decl) {
...
@@ -33,15 +33,9 @@ bool hasCLanguageLinkageType(FunctionDecl const * decl) {
if
(
decl
->
isExternC
())
{
if
(
decl
->
isExternC
())
{
return
true
;
return
true
;
}
}
#if CLANG_VERSION >= 30300
if
(
decl
->
isInExternCContext
())
{
if
(
decl
->
isInExternCContext
())
{
return
true
;
return
true
;
}
}
#else
if
(
decl
->
getCanonicalDecl
()
->
getDeclContext
()
->
isExternCContext
())
{
return
true
;
}
#endif
return
false
;
return
false
;
}
}
...
@@ -134,13 +128,13 @@ bool UnrefFun::VisitFunctionDecl(FunctionDecl const * decl) {
...
@@ -134,13 +128,13 @@ bool UnrefFun::VisitFunctionDecl(FunctionDecl const * decl) {
{
{
return
true
;
return
true
;
}
}
compat
::
LinkageInfo
info
(
canon
->
getLinkageAndVisibility
());
LinkageInfo
info
(
canon
->
getLinkageAndVisibility
());
if
(
compat
::
getLinkage
(
info
)
==
ExternalLinkage
if
(
info
.
getLinkage
(
)
==
ExternalLinkage
&&
hasCLanguageLinkageType
(
canon
)
&&
canon
->
isDefined
()
&&
hasCLanguageLinkageType
(
canon
)
&&
canon
->
isDefined
()
&&
((
decl
==
canon
&&
compat
::
getVisibility
(
info
)
==
DefaultVisibility
)
&&
((
decl
==
canon
&&
info
.
getVisibility
(
)
==
DefaultVisibility
)
||
((
canon
->
hasAttr
<
ConstructorAttr
>
()
||
((
canon
->
hasAttr
<
ConstructorAttr
>
()
||
canon
->
hasAttr
<
DestructorAttr
>
())
||
canon
->
hasAttr
<
DestructorAttr
>
())
&&
compat
::
getVisibility
(
info
)
==
HiddenVisibility
)))
&&
info
.
getVisibility
(
)
==
HiddenVisibility
)))
{
{
return
true
;
return
true
;
}
}
...
...
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