This revision was automatically updated to reflect the committed changes. Closed by commit rGc1fb23c1aadd: [clang][ASTImporter] Fix import of VarDecl regarding thread local storage spec (authored by Balazs Benics <balazsben...@sigmatechnology.se>).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D98707/new/ https://reviews.llvm.org/D98707 Files: clang/lib/AST/ASTImporter.cpp clang/unittests/AST/ASTImporterTest.cpp Index: clang/unittests/AST/ASTImporterTest.cpp =================================================================== --- clang/unittests/AST/ASTImporterTest.cpp +++ clang/unittests/AST/ASTImporterTest.cpp @@ -735,6 +735,12 @@ has(declStmt(hasSingleDecl(varDecl(hasName("d"))))))))); } +TEST_P(ImportDecl, ImportedVarDeclPreservesThreadLocalStorage) { + MatchVerifier<Decl> Verifier; + testImport("thread_local int declToImport;", Lang_CXX11, "", Lang_CXX11, + Verifier, varDecl(hasThreadStorageDuration())); +} + TEST_P(ASTImporterOptionSpecificTestBase, ImportRecordTypeInFunc) { Decl *FromTU = getTuDecl("int declToImport() { " " struct data_t {int a;int b;};" Index: clang/lib/AST/ASTImporter.cpp =================================================================== --- clang/lib/AST/ASTImporter.cpp +++ clang/lib/AST/ASTImporter.cpp @@ -4018,6 +4018,7 @@ D->getStorageClass())) return ToVar; + ToVar->setTSCSpec(D->getTSCSpec()); ToVar->setQualifierInfo(ToQualifierLoc); ToVar->setAccess(D->getAccess()); ToVar->setLexicalDeclContext(LexicalDC);
Index: clang/unittests/AST/ASTImporterTest.cpp =================================================================== --- clang/unittests/AST/ASTImporterTest.cpp +++ clang/unittests/AST/ASTImporterTest.cpp @@ -735,6 +735,12 @@ has(declStmt(hasSingleDecl(varDecl(hasName("d"))))))))); } +TEST_P(ImportDecl, ImportedVarDeclPreservesThreadLocalStorage) { + MatchVerifier<Decl> Verifier; + testImport("thread_local int declToImport;", Lang_CXX11, "", Lang_CXX11, + Verifier, varDecl(hasThreadStorageDuration())); +} + TEST_P(ASTImporterOptionSpecificTestBase, ImportRecordTypeInFunc) { Decl *FromTU = getTuDecl("int declToImport() { " " struct data_t {int a;int b;};" Index: clang/lib/AST/ASTImporter.cpp =================================================================== --- clang/lib/AST/ASTImporter.cpp +++ clang/lib/AST/ASTImporter.cpp @@ -4018,6 +4018,7 @@ D->getStorageClass())) return ToVar; + ToVar->setTSCSpec(D->getTSCSpec()); ToVar->setQualifierInfo(ToQualifierLoc); ToVar->setAccess(D->getAccess()); ToVar->setLexicalDeclContext(LexicalDC);
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits