summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2013-05-31 18:50:15 +0200
committerLuboš Luňák <l.lunak@suse.cz>2013-06-13 20:38:29 +0200
commiteb437a7afb5465eccc70fb65b80445c53d9a8f90 (patch)
tree7f77ec1c489f7cb6ef66ba821ab478ea742f878f
parent681ee40d19baed0ab91bef338084ddf849746f5f (diff)
update for PPCallbacks API changes in Clang3.3
Change-Id: I8493afa8e2264a42fba090c9c72f36f36cb2d165
-rw-r--r--compilerplugins/clang/checkconfigmacros.cxx35
-rw-r--r--compilerplugins/clang/rtlconstasciimacro.cxx10
2 files changed, 43 insertions, 2 deletions
diff --git a/compilerplugins/clang/checkconfigmacros.cxx b/compilerplugins/clang/checkconfigmacros.cxx
index 3a220456ef25..8524d7b8edb6 100644
--- a/compilerplugins/clang/checkconfigmacros.cxx
+++ b/compilerplugins/clang/checkconfigmacros.cxx
@@ -32,11 +32,19 @@ class CheckConfigMacros
public:
explicit CheckConfigMacros( CompilerInstance& compiler );
virtual void run() override;
+#if __clang_major__ < 3 || __clang_major__ == 3 && __clang_minor__ < 2
virtual void MacroDefined( const Token& macroToken, const MacroInfo* info ) override;
- virtual void MacroUndefined( 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 MacroUndefined( const Token& macroToken, const MacroDirective* info ) override;
+ virtual void Ifdef( SourceLocation location, const Token& macroToken, const MacroDirective* info ) override;
+ virtual void Ifndef( SourceLocation location, const Token& macroToken, const MacroDirective* info ) override;
+ virtual void Defined( const Token& macroToken, const MacroDirective* info ) override;
+#endif
private:
void checkMacro( const Token& macroToken, SourceLocation location );
std::set< string > configMacros;
@@ -53,9 +61,16 @@ void CheckConfigMacros::run()
// nothing, only check preprocessor usage
}
+#if __clang_major__ < 3 || __clang_major__ == 3 && __clang_minor__ < 2
void CheckConfigMacros::MacroDefined( const Token& macroToken, const MacroInfo* info )
{
- const char* filename = compiler.getSourceManager().getPresumedLoc( info->getDefinitionLoc()).getFilename();
+ SourceLocation location = info->getDefinitionLoc();
+#else
+void CheckConfigMacros::MacroDefined( const Token& macroToken, const MacroDirective* info )
+ {
+ SourceLocation location = info->getLocation();
+#endif
+ const char* filename = compiler.getSourceManager().getPresumedLoc( location ).getFilename();
if( filename != NULL
&& ( strncmp( filename, BUILDDIR "/config_host/", strlen( BUILDDIR "/config_host/" )) == 0
|| strncmp( filename, BUILDDIR "/config_build/", strlen( BUILDDIR "/config_build/" )) == 0 ))
@@ -65,22 +80,38 @@ void CheckConfigMacros::MacroDefined( const Token& macroToken, const MacroInfo*
}
}
+#if __clang_major__ < 3 || __clang_major__ == 3 && __clang_minor__ < 2
void CheckConfigMacros::MacroUndefined( const Token& macroToken, const MacroInfo* )
+#else
+void CheckConfigMacros::MacroUndefined( const Token& macroToken, const MacroDirective* )
+#endif
{
configMacros.erase( macroToken.getIdentifierInfo()->getName());
}
+#if __clang_major__ < 3 || __clang_major__ == 3 && __clang_minor__ < 2
void CheckConfigMacros::Ifdef( SourceLocation location, const Token& macroToken )
+#else
+void CheckConfigMacros::Ifdef( SourceLocation location, const Token& macroToken, const MacroDirective* )
+#endif
{
checkMacro( macroToken, location );
}
+#if __clang_major__ < 3 || __clang_major__ == 3 && __clang_minor__ < 2
void CheckConfigMacros::Ifndef( SourceLocation location, const Token& macroToken )
+#else
+void CheckConfigMacros::Ifndef( SourceLocation location, const Token& macroToken, const MacroDirective* )
+#endif
{
checkMacro( macroToken, location );
}
+#if __clang_major__ < 3 || __clang_major__ == 3 && __clang_minor__ < 2
void CheckConfigMacros::Defined( const Token& macroToken )
+#else
+void CheckConfigMacros::Defined( const Token& macroToken, const MacroDirective* )
+#endif
{
checkMacro( macroToken, macroToken.getLocation());
}
diff --git a/compilerplugins/clang/rtlconstasciimacro.cxx b/compilerplugins/clang/rtlconstasciimacro.cxx
index 331401afbc9c..d3843149b2ea 100644
--- a/compilerplugins/clang/rtlconstasciimacro.cxx
+++ b/compilerplugins/clang/rtlconstasciimacro.cxx
@@ -33,7 +33,12 @@ class RtlConstAsciiMacro
bool VisitCXXConstructExpr( CXXConstructExpr* expr );
bool VisitCXXTemporaryObjectExpr( CXXTemporaryObjectExpr* expr );
bool VisitStringLiteral( const StringLiteral* literal );
+#if __clang_major__ < 3 || __clang_major__ == 3 && __clang_minor__ < 3
virtual void MacroExpands( const Token& macro, const MacroInfo* info, SourceRange range ) override;
+#else
+ virtual void MacroExpands( const Token& macro, const MacroDirective* directive,
+ SourceRange range, const MacroArgs* args ) override;
+#endif
private:
map< SourceLocation, SourceLocation > expansions; // start location -> end location
bool searchingForString;
@@ -53,7 +58,12 @@ void RtlConstAsciiMacro::run()
}
+#if __clang_major__ < 3 || __clang_major__ == 3 && __clang_minor__ < 3
void RtlConstAsciiMacro::MacroExpands( const Token& macro, const MacroInfo*, SourceRange range )
+#else
+void RtlConstAsciiMacro::MacroExpands( const Token& macro, const MacroDirective*,
+ SourceRange range, const MacroArgs* )
+#endif
{
if( macro.getIdentifierInfo()->getName() != "RTL_CONSTASCII_USTRINGPARAM" )
return;