summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--basctl/source/basicide/basicbox.cxx2
-rw-r--r--basctl/source/basicide/bastypes.cxx4
-rw-r--r--basctl/source/dlged/managelang.cxx2
-rw-r--r--basctl/source/inc/bastypes.hxx3
-rw-r--r--basctl/source/inc/managelang.hxx5
-rw-r--r--compilerplugins/clang/unusedfields.cxx45
6 files changed, 48 insertions, 13 deletions
diff --git a/basctl/source/basicide/basicbox.cxx b/basctl/source/basicide/basicbox.cxx
index f4922b5b5661..78518d108792 100644
--- a/basctl/source/basicide/basicbox.cxx
+++ b/basctl/source/basicide/basicbox.cxx
@@ -418,7 +418,7 @@ void LanguageBox::FillBox()
sLanguage += m_sDefaultLanguageStr;
}
sal_Int32 nPos = InsertEntry( sLanguage );
- SetEntryData( nPos, new LanguageEntry( sLanguage, pLocale[i], bIsDefault ) );
+ SetEntryData( nPos, new LanguageEntry( pLocale[i], bIsDefault ) );
if ( bIsCurrent )
nSelPos = nPos;
diff --git a/basctl/source/basicide/bastypes.cxx b/basctl/source/basicide/bastypes.cxx
index 30f83fa6f2ee..4d0da3c271cd 100644
--- a/basctl/source/basicide/bastypes.cxx
+++ b/basctl/source/basicide/bastypes.cxx
@@ -732,7 +732,7 @@ void LibInfos::InsertInfo (
{
Key aKey(rDocument, rLibName);
m_aMap.erase(aKey);
- m_aMap.insert(Map::value_type(aKey, Item(rDocument, rLibName, rCurrentName, eCurrentType)));
+ m_aMap.insert(Map::value_type(aKey, Item(rDocument, rCurrentName, eCurrentType)));
}
void LibInfos::RemoveInfoFor (ScriptDocument const& rDocument)
@@ -772,12 +772,10 @@ size_t LibInfos::Key::Hash::operator () (Key const& rKey) const
LibInfos::Item::Item (
ScriptDocument const& rDocument,
- OUString const& rLibName,
OUString const& rCurrentName,
ItemType eCurrentType
) :
m_aDocument(rDocument),
- m_aLibName(rLibName),
m_aCurrentName(rCurrentName),
m_eCurrentType(eCurrentType)
{ }
diff --git a/basctl/source/dlged/managelang.cxx b/basctl/source/dlged/managelang.cxx
index 3864f83c22ff..56c0e8c67384 100644
--- a/basctl/source/dlged/managelang.cxx
+++ b/basctl/source/dlged/managelang.cxx
@@ -126,7 +126,7 @@ void ManageLanguageDialog::FillLanguageBox()
sLanguage += " " + m_sDefLangStr;
}
const sal_Int32 nPos = m_pLanguageLB->InsertEntry( sLanguage );
- m_pLanguageLB->SetEntryData( nPos, new LanguageEntry( sLanguage, pLocale[i], bIsDefault ) );
+ m_pLanguageLB->SetEntryData( nPos, new LanguageEntry( pLocale[i], bIsDefault ) );
}
}
else
diff --git a/basctl/source/inc/bastypes.hxx b/basctl/source/inc/bastypes.hxx
index 52a49b258924..d09a0cc9ea2d 100644
--- a/basctl/source/inc/bastypes.hxx
+++ b/basctl/source/inc/bastypes.hxx
@@ -273,12 +273,11 @@ public:
{
private:
ScriptDocument m_aDocument;
- OUString m_aLibName;
OUString m_aCurrentName;
ItemType m_eCurrentType;
public:
- Item (ScriptDocument const&, OUString const& rLibName, OUString const& rCurrentName, ItemType eCurrentType);
+ Item (ScriptDocument const&, OUString const& rCurrentName, ItemType eCurrentType);
~Item ();
const OUString& GetCurrentName() const { return m_aCurrentName; }
ItemType GetCurrentType() const { return m_eCurrentType; }
diff --git a/basctl/source/inc/managelang.hxx b/basctl/source/inc/managelang.hxx
index a9a8eca872e9..14bf40347894 100644
--- a/basctl/source/inc/managelang.hxx
+++ b/basctl/source/inc/managelang.hxx
@@ -34,14 +34,11 @@ class LocalizationMgr;
struct LanguageEntry
{
- OUString m_sLanguage;
css::lang::Locale m_aLocale;
bool m_bIsDefault;
- LanguageEntry( const OUString& _rLanguage,
- const css::lang::Locale& _rLocale,
+ LanguageEntry( const css::lang::Locale& _rLocale,
bool _bIsDefault ) :
- m_sLanguage( _rLanguage ),
m_aLocale( _rLocale ),
m_bIsDefault( _bIsDefault ) {}
};
diff --git a/compilerplugins/clang/unusedfields.cxx b/compilerplugins/clang/unusedfields.cxx
index 95bce5e5bd9f..d00235674370 100644
--- a/compilerplugins/clang/unusedfields.cxx
+++ b/compilerplugins/clang/unusedfields.cxx
@@ -170,8 +170,49 @@ bool UnusedFields::VisitFieldDecl( const FieldDecl* fieldDecl )
{
fieldDecl = fieldDecl->getCanonicalDecl();
- if( !ignoreLocation( fieldDecl ))
- definitionSet.insert(niceName(fieldDecl));
+ if( ignoreLocation( fieldDecl ))
+ return true;
+
+ QualType type = fieldDecl->getType();
+ // unwrap array types
+ while (type->isArrayType())
+ type = type->getAsArrayTypeUnsafe()->getElementType();
+
+ if( CXXRecordDecl* recordDecl = type->getAsCXXRecordDecl() )
+ {
+ bool warn_unused = false;
+ if( recordDecl->hasAttrs())
+ {
+ // Clang currently has no support for custom attributes, but
+ // the annotate attribute comes close, so check for __attribute__((annotate("lo_warn_unused")))
+ for( specific_attr_iterator<AnnotateAttr> i = recordDecl->specific_attr_begin<AnnotateAttr>(),
+ e = recordDecl->specific_attr_end<AnnotateAttr>();
+ i != e;
+ ++i )
+ {
+ if( (*i)->getAnnotation() == "lo_warn_unused" )
+ {
+ warn_unused = true;
+ break;
+ }
+ }
+ }
+ if( !warn_unused )
+ {
+ string n = recordDecl->getQualifiedNameAsString();
+ if( n == "rtl::OUString" )
+ warn_unused = true;
+ // Check some common non-LO types.
+ if( n == "std::string" || n == "std::basic_string"
+ || n == "std::list" || n == "std::__debug::list"
+ || n == "std::vector" || n == "std::__debug::vector" )
+ warn_unused = true;
+ }
+ if (!warn_unused)
+ return true;
+ }
+
+ definitionSet.insert(niceName(fieldDecl));
return true;
}