Skip to content
Snippets Groups Projects
Commit 2d588b4b authored by Fariborz Jahanian's avatar Fariborz Jahanian
Browse files

documentation parsing: patch to make @class work for

class templates; and similarly, @function  works for 
function templates. // rdar://14124702


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184329 91177308-0d34-0410-b5e6-96231b3b80d8
parent 2d8b2796
Branches
No related tags found
No related merge requests found
...@@ -220,6 +220,8 @@ public: ...@@ -220,6 +220,8 @@ public:
bool isUnionDecl(); bool isUnionDecl();
bool isObjCInterfaceDecl(); bool isObjCInterfaceDecl();
bool isObjCProtocolDecl(); bool isObjCProtocolDecl();
bool isClassTemplateDecl();
bool isFunctionTemplateDecl();
ArrayRef<const ParmVarDecl *> getParamVars(); ArrayRef<const ParmVarDecl *> getParamVars();
......
...@@ -99,10 +99,10 @@ void Sema::checkFunctionDeclVerbatimLine(const BlockCommandComment *Comment) { ...@@ -99,10 +99,10 @@ void Sema::checkFunctionDeclVerbatimLine(const BlockCommandComment *Comment) {
unsigned DiagSelect; unsigned DiagSelect;
switch (Comment->getCommandID()) { switch (Comment->getCommandID()) {
case CommandTraits::KCI_function: case CommandTraits::KCI_function:
DiagSelect = !isAnyFunctionDecl() ? 1 : 0; DiagSelect = (!isAnyFunctionDecl() && !isFunctionTemplateDecl())? 1 : 0;
break; break;
case CommandTraits::KCI_functiongroup: case CommandTraits::KCI_functiongroup:
DiagSelect = !isAnyFunctionDecl() ? 2 : 0; DiagSelect = (!isAnyFunctionDecl() && !isFunctionTemplateDecl())? 2 : 0;
break; break;
case CommandTraits::KCI_method: case CommandTraits::KCI_method:
DiagSelect = !isObjCMethodDecl() ? 3 : 0; DiagSelect = !isObjCMethodDecl() ? 3 : 0;
...@@ -131,7 +131,7 @@ void Sema::checkContainerDeclVerbatimLine(const BlockCommandComment *Comment) { ...@@ -131,7 +131,7 @@ void Sema::checkContainerDeclVerbatimLine(const BlockCommandComment *Comment) {
unsigned DiagSelect; unsigned DiagSelect;
switch (Comment->getCommandID()) { switch (Comment->getCommandID()) {
case CommandTraits::KCI_class: case CommandTraits::KCI_class:
DiagSelect = !isClassOrStructDecl() ? 1 : 0; DiagSelect = (!isClassOrStructDecl() && !isClassTemplateDecl()) ? 1 : 0;
// Allow @class command on @interface declarations. // Allow @class command on @interface declarations.
// FIXME. Currently, \class and @class are indistinguishable. So, // FIXME. Currently, \class and @class are indistinguishable. So,
// \class is also allowed on an @interface declaration // \class is also allowed on an @interface declaration
...@@ -870,6 +870,24 @@ bool Sema::isClassOrStructDecl() { ...@@ -870,6 +870,24 @@ bool Sema::isClassOrStructDecl() {
isa<RecordDecl>(ThisDeclInfo->CurrentDecl) && isa<RecordDecl>(ThisDeclInfo->CurrentDecl) &&
!isUnionDecl(); !isUnionDecl();
} }
bool Sema::isClassTemplateDecl() {
if (!ThisDeclInfo)
return false;
if (!ThisDeclInfo->IsFilled)
inspectThisDecl();
return ThisDeclInfo->CurrentDecl &&
(isa<ClassTemplateDecl>(ThisDeclInfo->CurrentDecl));
}
bool Sema::isFunctionTemplateDecl() {
if (!ThisDeclInfo)
return false;
if (!ThisDeclInfo->IsFilled)
inspectThisDecl();
return ThisDeclInfo->CurrentDecl &&
(isa<FunctionTemplateDecl>(ThisDeclInfo->CurrentDecl));
}
bool Sema::isObjCInterfaceDecl() { bool Sema::isObjCInterfaceDecl() {
if (!ThisDeclInfo) if (!ThisDeclInfo)
......
...@@ -950,3 +950,47 @@ class C1; ...@@ -950,3 +950,47 @@ class C1;
@struct S3; @struct S3;
*/ */
class S3; class S3;
// rdar://14124702
//----------------------------------------------------------------------
/// @class Predicate Predicate.h "lldb/Host/Predicate.h"
/// @brief A C++ wrapper class for providing threaded access to a value
/// of type T.
///
/// A templatized class.
/// specified values.
//----------------------------------------------------------------------
template <class T, class T1>
class Predicate
{
};
//----------------------------------------------------------------------
/// @class Predicate<int, char> Predicate.h "lldb/Host/Predicate.h"
/// @brief A C++ wrapper class for providing threaded access to a value
/// of type T.
///
/// A template specilization class.
//----------------------------------------------------------------------
template<> class Predicate<int, char>
{
};
//----------------------------------------------------------------------
/// @class Predicate<T, int> Predicate.h "lldb/Host/Predicate.h"
/// @brief A C++ wrapper class for providing threaded access to a value
/// of type T.
///
/// A partial specialization template class.
//----------------------------------------------------------------------
template<class T> class Predicate<T, int>
{
};
/*! @function test_function
*/
template <class T> T test_function (T arg);
/*! @function test_function<int>
*/
template <> int test_function<int> (int arg);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment