diff options
author | Dmitri Gribenko <gribozavr@gmail.com> | 2013-02-22 14:21:27 +0000 |
---|---|---|
committer | Dmitri Gribenko <gribozavr@gmail.com> | 2013-02-22 14:21:27 +0000 |
commit | 6ebf09130479bc7605aa09a3e6c4dc2ba3513495 (patch) | |
tree | be83c24b25f848bc5ad0f9759a3405fcd49e5b79 /lib/Serialization | |
parent | 9d4df46b6c78825303ffbdd01bbe8d4b4513ed89 (diff) |
Comment parsing: add CommentOptions to allow specifying custom comment block commands
Add an ability to specify custom documentation block comment commands via a new
class CommentOptions. The intention is that this class will hold future
customizations for comment parsing, including defining documentation comments
with specific numbers of parameters, etc.
CommentOptions instance is a member of LangOptions.
CommentOptions is controlled by a new command-line parameter
-fcomment-block-commands=Foo,Bar,Baz.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175892 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization')
-rw-r--r-- | lib/Serialization/ASTReader.cpp | 17 | ||||
-rw-r--r-- | lib/Serialization/ASTWriter.cpp | 10 |
2 files changed, 27 insertions, 0 deletions
diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp index 6dff373fda..da3add3161 100644 --- a/lib/Serialization/ASTReader.cpp +++ b/lib/Serialization/ASTReader.cpp @@ -108,6 +108,14 @@ static bool checkLanguageOptions(const LangOptions &LangOpts, return true; } + if (ExistingLangOpts.CommentOpts.BlockCommandNames != + LangOpts.CommentOpts.BlockCommandNames) { + if (Diags) + Diags->Report(diag::err_pch_langopt_value_mismatch) + << "block command names"; + return true; + } + return false; } @@ -3671,6 +3679,15 @@ bool ASTReader::ParseLanguageOptions(const RecordData &Record, unsigned Length = Record[Idx++]; LangOpts.CurrentModule.assign(Record.begin() + Idx, Record.begin() + Idx + Length); + + Idx += Length; + + // Comment options. + for (unsigned N = Record[Idx++]; N; --N) { + LangOpts.CommentOpts.BlockCommandNames.push_back( + ReadString(Record, Idx)); + } + return Listener.ReadLanguageOptions(LangOpts, Complain); } diff --git a/lib/Serialization/ASTWriter.cpp b/lib/Serialization/ASTWriter.cpp index 09c5bbb63b..b0e36e2e0d 100644 --- a/lib/Serialization/ASTWriter.cpp +++ b/lib/Serialization/ASTWriter.cpp @@ -1057,6 +1057,16 @@ void ASTWriter::WriteControlBlock(Preprocessor &PP, ASTContext &Context, Record.push_back(LangOpts.CurrentModule.size()); Record.append(LangOpts.CurrentModule.begin(), LangOpts.CurrentModule.end()); + + // Comment options. + Record.push_back(LangOpts.CommentOpts.BlockCommandNames.size()); + for (CommentOptions::BlockCommandNamesTy::const_iterator + I = LangOpts.CommentOpts.BlockCommandNames.begin(), + IEnd = LangOpts.CommentOpts.BlockCommandNames.end(); + I != IEnd; ++I) { + AddString(*I, Record); + } + Stream.EmitRecord(LANGUAGE_OPTIONS, Record); // Target options. |