diff options
author | Nico Weber <nicolasweber@gmx.de> | 2016-03-02 19:28:54 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2016-03-02 19:28:54 +0000 |
commit | cbbaeb13074400ead830be88143c31e7aac3c01c (patch) | |
tree | d55d8e042104532293a3a2d729f706fb0b318111 /clang/lib/Serialization/ASTWriterDecl.cpp | |
parent | 65f9d9cd324fc12f8bf90fa67477e2ddd90803d6 (diff) | |
download | llvm-cbbaeb13074400ead830be88143c31e7aac3c01c.zip llvm-cbbaeb13074400ead830be88143c31e7aac3c01c.tar.gz llvm-cbbaeb13074400ead830be88143c31e7aac3c01c.tar.bz2 |
Serialize `#pragma detect_mismatch`.
This is like r262493, but for pragma detect_mismatch instead of pragma comment.
The two pragmas have similar behavior, so use the same approach for both.
llvm-svn: 262506
Diffstat (limited to 'clang/lib/Serialization/ASTWriterDecl.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTWriterDecl.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/lib/Serialization/ASTWriterDecl.cpp b/clang/lib/Serialization/ASTWriterDecl.cpp index bf36af6..ee693bf 100644 --- a/clang/lib/Serialization/ASTWriterDecl.cpp +++ b/clang/lib/Serialization/ASTWriterDecl.cpp @@ -50,6 +50,7 @@ namespace clang { void VisitDecl(Decl *D); void VisitPragmaCommentDecl(PragmaCommentDecl *D); + void VisitPragmaDetectMismatchDecl(PragmaDetectMismatchDecl *D); void VisitTranslationUnitDecl(TranslationUnitDecl *D); void VisitNamedDecl(NamedDecl *D); void VisitLabelDecl(LabelDecl *LD); @@ -326,6 +327,18 @@ void ASTDeclWriter::VisitPragmaCommentDecl(PragmaCommentDecl *D) { Code = serialization::DECL_PRAGMA_COMMENT; } +void ASTDeclWriter::VisitPragmaDetectMismatchDecl( + PragmaDetectMismatchDecl *D) { + StringRef Name = D->getName(); + StringRef Value = D->getValue(); + Record.push_back(Name.size() + 1 + Value.size()); + VisitDecl(D); + Writer.AddSourceLocation(D->getLocStart(), Record); + Writer.AddString(Name, Record); + Writer.AddString(Value, Record); + Code = serialization::DECL_PRAGMA_DETECT_MISMATCH; +} + void ASTDeclWriter::VisitTranslationUnitDecl(TranslationUnitDecl *D) { llvm_unreachable("Translation units aren't directly serialized"); } |