[cfe-commits] r80183 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td include/clang/Basic/PartialDiagnostic.h lib/Sema/Sema.h lib/Sema/SemaDeclCXX.cpp
Anders Carlsson
andersca at mac.com
Wed Aug 26 17:13:58 PDT 2009
Author: andersca
Date: Wed Aug 26 19:13:57 2009
New Revision: 80183
URL: http://llvm.org/viewvc/llvm-project?rev=80183&view=rev
Log:
New RequireNonAbstractType function.
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Basic/PartialDiagnostic.h
cfe/trunk/lib/Sema/Sema.h
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=80183&r1=80182&r2=80183&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed Aug 26 19:13:57 2009
@@ -315,7 +315,7 @@
"destructor|conversion operator}0 as a friend">;
def err_abstract_type_in_decl : Error<
- "%select{return|parameter|variable|field}1 type %0 is an abstract class">;
+ "%select{return|parameter|variable|field}0 type %1 is an abstract class">;
def err_allocation_of_abstract_type : Error<
"allocation of an object of abstract type %0">;
Modified: cfe/trunk/include/clang/Basic/PartialDiagnostic.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/PartialDiagnostic.h?rev=80183&r1=80182&r2=80183&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/PartialDiagnostic.h (original)
+++ cfe/trunk/include/clang/Basic/PartialDiagnostic.h Wed Aug 26 19:13:57 2009
@@ -115,18 +115,23 @@
}
friend const PartialDiagnostic &operator<<(const PartialDiagnostic &PD,
- QualType T) {
+ QualType T) {
PD.AddTaggedVal(reinterpret_cast<intptr_t>(T.getAsOpaquePtr()),
Diagnostic::ak_qualtype);
return PD;
}
+ friend const PartialDiagnostic &operator<<(const PartialDiagnostic &PD,
+ unsigned I) {
+ PD.AddTaggedVal(I, Diagnostic::ak_uint);
+ return PD;
+ }
+
friend inline const PartialDiagnostic &operator<<(const PartialDiagnostic &PD,
const SourceRange &R) {
PD.AddSourceRange(R);
return PD;
}
-
};
inline PartialDiagnostic PDiag(unsigned DiagID) {
Modified: cfe/trunk/lib/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.h?rev=80183&r1=80182&r2=80183&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/Sema.h (original)
+++ cfe/trunk/lib/Sema/Sema.h Wed Aug 26 19:13:57 2009
@@ -2211,6 +2211,10 @@
AbstractFieldType
};
+ bool RequireNonAbstractType(SourceLocation Loc, QualType T,
+ const PartialDiagnostic &PD,
+ const CXXRecordDecl *CurrentRD = 0);
+
bool RequireNonAbstractType(SourceLocation Loc, QualType T, unsigned DiagID,
AbstractDiagSelID SelID = AbstractNone,
const CXXRecordDecl *CurrentRD = 0);
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=80183&r1=80182&r2=80183&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Wed Aug 26 19:13:57 2009
@@ -1149,15 +1149,26 @@
}
}
+
bool Sema::RequireNonAbstractType(SourceLocation Loc, QualType T,
unsigned DiagID, AbstractDiagSelID SelID,
const CXXRecordDecl *CurrentRD) {
+ if (SelID == -1)
+ return RequireNonAbstractType(Loc, T,
+ PDiag(DiagID), CurrentRD);
+ else
+ return RequireNonAbstractType(Loc, T,
+ PDiag(DiagID) << SelID, CurrentRD);
+}
+bool Sema::RequireNonAbstractType(SourceLocation Loc, QualType T,
+ const PartialDiagnostic &PD,
+ const CXXRecordDecl *CurrentRD) {
if (!getLangOptions().CPlusPlus)
return false;
if (const ArrayType *AT = Context.getAsArrayType(T))
- return RequireNonAbstractType(Loc, AT->getElementType(), DiagID, SelID,
+ return RequireNonAbstractType(Loc, AT->getElementType(), PD,
CurrentRD);
if (const PointerType *PT = T->getAs<PointerType>()) {
@@ -1166,8 +1177,7 @@
PT = T;
if (const ArrayType *AT = Context.getAsArrayType(PT->getPointeeType()))
- return RequireNonAbstractType(Loc, AT->getElementType(), DiagID, SelID,
- CurrentRD);
+ return RequireNonAbstractType(Loc, AT->getElementType(), PD, CurrentRD);
}
const RecordType *RT = T->getAs<RecordType>();
@@ -1184,7 +1194,7 @@
if (!RD->isAbstract())
return false;
- Diag(Loc, DiagID) << RD->getDeclName() << SelID;
+ Diag(Loc, PD) << RD->getDeclName();
// Check if we've already emitted the list of pure virtual functions for this
// class.
More information about the cfe-commits
mailing list