summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
diff options
context:
space:
mode:
authorDmitri Gribenko <gribozavr@gmail.com>2012-07-23 16:43:01 +0000
committerDmitri Gribenko <gribozavr@gmail.com>2012-07-23 16:43:01 +0000
commitd73e4ce992a9c17937c8d3d616ceb391e6e97538 (patch)
tree1e439ed861ff3eb9049992544f158cfbd15efe2e /clang/lib/AST
parent9eedce1e7c9f8328df77637d29329919acb9c944 (diff)
downloadbcm5719-llvm-d73e4ce992a9c17937c8d3d616ceb391e6e97538.tar.gz
bcm5719-llvm-d73e4ce992a9c17937c8d3d616ceb391e6e97538.zip
Comment AST: add InlineContentComment::RenderKind to specify a default
rendering mode for clients that don't want to interpret Doxygen commands. Also add a libclang API to query this information. llvm-svn: 160633
Diffstat (limited to 'clang/lib/AST')
-rw-r--r--clang/lib/AST/CommentDumper.cpp15
-rw-r--r--clang/lib/AST/CommentSema.cpp38
2 files changed, 43 insertions, 10 deletions
diff --git a/clang/lib/AST/CommentDumper.cpp b/clang/lib/AST/CommentDumper.cpp
index 7a4ca0c12aa..c930b245043 100644
--- a/clang/lib/AST/CommentDumper.cpp
+++ b/clang/lib/AST/CommentDumper.cpp
@@ -107,6 +107,21 @@ void CommentDumper::visitInlineCommandComment(const InlineCommandComment *C) {
dumpComment(C);
OS << " Name=\"" << C->getCommandName() << "\"";
+ switch (C->getRenderKind()) {
+ case InlineCommandComment::RenderNormal:
+ OS << " RenderNormal";
+ break;
+ case InlineCommandComment::RenderBold:
+ OS << " RenderBold";
+ break;
+ case InlineCommandComment::RenderMonospaced:
+ OS << " RenderMonospaced";
+ break;
+ case InlineCommandComment::RenderEmphasized:
+ OS << " RenderEmphasized";
+ break;
+ }
+
for (unsigned i = 0, e = C->getNumArgs(); i != e; ++i)
OS << " Arg[" << i << "]=\"" << C->getArgText(i) << "\"";
}
diff --git a/clang/lib/AST/CommentSema.cpp b/clang/lib/AST/CommentSema.cpp
index 3d8635fb19d..6c37452e070 100644
--- a/clang/lib/AST/CommentSema.cpp
+++ b/clang/lib/AST/CommentSema.cpp
@@ -202,10 +202,12 @@ InlineCommandComment *Sema::actOnInlineCommand(SourceLocation CommandLocBegin,
SourceLocation CommandLocEnd,
StringRef CommandName) {
ArrayRef<InlineCommandComment::Argument> Args;
- return new (Allocator) InlineCommandComment(CommandLocBegin,
- CommandLocEnd,
- CommandName,
- Args);
+ return new (Allocator) InlineCommandComment(
+ CommandLocBegin,
+ CommandLocEnd,
+ CommandName,
+ getInlineCommandRenderKind(CommandName),
+ Args);
}
InlineCommandComment *Sema::actOnInlineCommand(SourceLocation CommandLocBegin,
@@ -219,17 +221,22 @@ InlineCommandComment *Sema::actOnInlineCommand(SourceLocation CommandLocBegin,
ArgLocEnd),
Arg);
- return new (Allocator) InlineCommandComment(CommandLocBegin,
- CommandLocEnd,
- CommandName,
- llvm::makeArrayRef(A, 1));
+ return new (Allocator) InlineCommandComment(
+ CommandLocBegin,
+ CommandLocEnd,
+ CommandName,
+ getInlineCommandRenderKind(CommandName),
+ llvm::makeArrayRef(A, 1));
}
InlineContentComment *Sema::actOnUnknownCommand(SourceLocation LocBegin,
SourceLocation LocEnd,
StringRef Name) {
ArrayRef<InlineCommandComment::Argument> Args;
- return new (Allocator) InlineCommandComment(LocBegin, LocEnd, Name, Args);
+ return new (Allocator) InlineCommandComment(
+ LocBegin, LocEnd, Name,
+ InlineCommandComment::RenderNormal,
+ Args);
}
TextComment *Sema::actOnText(SourceLocation LocBegin,
@@ -445,7 +452,7 @@ unsigned Sema::getBlockCommandNumArgs(StringRef Name) {
.Default(0);
}
-bool Sema::isInlineCommand(StringRef Name) {
+bool Sema::isInlineCommand(StringRef Name) const {
return llvm::StringSwitch<bool>(Name)
.Case("b", true)
.Cases("c", "p", true)
@@ -453,6 +460,17 @@ bool Sema::isInlineCommand(StringRef Name) {
.Default(false);
}
+InlineCommandComment::RenderKind
+Sema::getInlineCommandRenderKind(StringRef Name) const {
+ assert(isInlineCommand(Name));
+
+ return llvm::StringSwitch<InlineCommandComment::RenderKind>(Name)
+ .Case("b", InlineCommandComment::RenderBold)
+ .Cases("c", "p", InlineCommandComment::RenderMonospaced)
+ .Cases("a", "e", "em", InlineCommandComment::RenderEmphasized)
+ .Default(InlineCommandComment::RenderNormal);
+}
+
bool Sema::isHTMLEndTagOptional(StringRef Name) {
return llvm::StringSwitch<bool>(Name)
.Case("p", true)
OpenPOWER on IntegriCloud