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/ASTReaderDecl.cpp | |
parent | 65f9d9cd324fc12f8bf90fa67477e2ddd90803d6 (diff) | |
download | bcm5719-llvm-cbbaeb13074400ead830be88143c31e7aac3c01c.tar.gz bcm5719-llvm-cbbaeb13074400ead830be88143c31e7aac3c01c.zip |
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/ASTReaderDecl.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTReaderDecl.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp index a7eded1a2fd..213f2aa0ecf 100644 --- a/clang/lib/Serialization/ASTReaderDecl.cpp +++ b/clang/lib/Serialization/ASTReaderDecl.cpp @@ -243,6 +243,7 @@ namespace clang { void VisitDecl(Decl *D); void VisitPragmaCommentDecl(PragmaCommentDecl *D); + void VisitPragmaDetectMismatchDecl(PragmaDetectMismatchDecl *D); void VisitTranslationUnitDecl(TranslationUnitDecl *TU); void VisitNamedDecl(NamedDecl *ND); void VisitLabelDecl(LabelDecl *LD); @@ -552,6 +553,20 @@ void ASTDeclReader::VisitPragmaCommentDecl(PragmaCommentDecl *D) { D->getTrailingObjects<char>()[Arg.size()] = '\0'; } +void ASTDeclReader::VisitPragmaDetectMismatchDecl(PragmaDetectMismatchDecl *D) { + VisitDecl(D); + D->setLocation(ReadSourceLocation(Record, Idx)); + std::string Name = ReadString(Record, Idx); + memcpy(D->getTrailingObjects<char>(), Name.data(), Name.size()); + D->getTrailingObjects<char>()[Name.size()] = '\0'; + + D->ValueStart = Name.size() + 1; + std::string Value = ReadString(Record, Idx); + memcpy(D->getTrailingObjects<char>() + D->ValueStart, Value.data(), + Value.size()); + D->getTrailingObjects<char>()[D->ValueStart + Value.size()] = '\0'; +} + void ASTDeclReader::VisitTranslationUnitDecl(TranslationUnitDecl *TU) { llvm_unreachable("Translation units are not serialized"); } @@ -2433,6 +2448,7 @@ static bool isConsumerInterestedIn(Decl *D, bool HasBody) { isa<ObjCImplDecl>(D) || isa<ImportDecl>(D) || isa<PragmaCommentDecl>(D) || + isa<PragmaDetectMismatchDecl>(D) || isa<OMPThreadPrivateDecl>(D)) return true; if (VarDecl *Var = dyn_cast<VarDecl>(D)) @@ -3353,6 +3369,10 @@ Decl *ASTReader::ReadDeclRecord(DeclID ID) { case DECL_PRAGMA_COMMENT: D = PragmaCommentDecl::CreateDeserialized(Context, ID, Record[Idx++]); break; + case DECL_PRAGMA_DETECT_MISMATCH: + D = PragmaDetectMismatchDecl::CreateDeserialized(Context, ID, + Record[Idx++]); + break; case DECL_EMPTY: D = EmptyDecl::CreateDeserialized(Context, ID); break; |