This revision was automatically updated to reflect the committed changes. Closed by commit rGcc006acdd6d7: [clang] Fix delayed template parsing (authored by sepavloff).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D155380/new/ https://reviews.llvm.org/D155380 Files: clang/include/clang/Sema/Sema.h clang/lib/Parse/ParseTemplate.cpp clang/test/PCH/late-parsed-instantiations.cpp Index: clang/test/PCH/late-parsed-instantiations.cpp =================================================================== --- clang/test/PCH/late-parsed-instantiations.cpp +++ clang/test/PCH/late-parsed-instantiations.cpp @@ -4,7 +4,9 @@ // RUN: %clang_cc1 -fdelayed-template-parsing -std=c++14 -emit-pch -fpch-instantiate-templates %s -o %t.pch -verify // RUN: %clang_cc1 -fdelayed-template-parsing -std=c++14 -include-pch %t.pch %s -verify -// XFAIL: target={{.*}}-aix{{.*}} +// Run this test for i686 as this is the target that modifies default FP options. +// RUN: %clang_cc1 -triple i686-pc-linux-gnu -fdelayed-template-parsing -std=c++14 -emit-pch -fpch-instantiate-templates %s -o %t.pch -verify +// RUN: %clang_cc1 -triple i686-pc-linux-gnu -fdelayed-template-parsing -std=c++14 -include-pch %t.pch %s -verify #ifndef HEADER_INCLUDED Index: clang/lib/Parse/ParseTemplate.cpp =================================================================== --- clang/lib/Parse/ParseTemplate.cpp +++ clang/lib/Parse/ParseTemplate.cpp @@ -1744,6 +1744,7 @@ // Parsing should occur with empty FP pragma stack and FP options used in the // point of the template definition. + Sema::FpPragmaStackSaveRAII SavedStack(Actions); Actions.resetFPOptions(LPT.FPO); assert(!LPT.Toks.empty() && "Empty body!"); Index: clang/include/clang/Sema/Sema.h =================================================================== --- clang/include/clang/Sema/Sema.h +++ clang/include/clang/Sema/Sema.h @@ -710,6 +710,16 @@ return result; } + class FpPragmaStackSaveRAII { + public: + FpPragmaStackSaveRAII(Sema &S) : S(S), SavedStack(S.FpPragmaStack) {} + ~FpPragmaStackSaveRAII() { S.FpPragmaStack = std::move(SavedStack); } + + private: + Sema &S; + PragmaStack<FPOptionsOverride> SavedStack; + }; + void resetFPOptions(FPOptions FPO) { CurFPFeatures = FPO; FpPragmaStack.Stack.clear();
Index: clang/test/PCH/late-parsed-instantiations.cpp =================================================================== --- clang/test/PCH/late-parsed-instantiations.cpp +++ clang/test/PCH/late-parsed-instantiations.cpp @@ -4,7 +4,9 @@ // RUN: %clang_cc1 -fdelayed-template-parsing -std=c++14 -emit-pch -fpch-instantiate-templates %s -o %t.pch -verify // RUN: %clang_cc1 -fdelayed-template-parsing -std=c++14 -include-pch %t.pch %s -verify -// XFAIL: target={{.*}}-aix{{.*}} +// Run this test for i686 as this is the target that modifies default FP options. +// RUN: %clang_cc1 -triple i686-pc-linux-gnu -fdelayed-template-parsing -std=c++14 -emit-pch -fpch-instantiate-templates %s -o %t.pch -verify +// RUN: %clang_cc1 -triple i686-pc-linux-gnu -fdelayed-template-parsing -std=c++14 -include-pch %t.pch %s -verify #ifndef HEADER_INCLUDED Index: clang/lib/Parse/ParseTemplate.cpp =================================================================== --- clang/lib/Parse/ParseTemplate.cpp +++ clang/lib/Parse/ParseTemplate.cpp @@ -1744,6 +1744,7 @@ // Parsing should occur with empty FP pragma stack and FP options used in the // point of the template definition. + Sema::FpPragmaStackSaveRAII SavedStack(Actions); Actions.resetFPOptions(LPT.FPO); assert(!LPT.Toks.empty() && "Empty body!"); Index: clang/include/clang/Sema/Sema.h =================================================================== --- clang/include/clang/Sema/Sema.h +++ clang/include/clang/Sema/Sema.h @@ -710,6 +710,16 @@ return result; } + class FpPragmaStackSaveRAII { + public: + FpPragmaStackSaveRAII(Sema &S) : S(S), SavedStack(S.FpPragmaStack) {} + ~FpPragmaStackSaveRAII() { S.FpPragmaStack = std::move(SavedStack); } + + private: + Sema &S; + PragmaStack<FPOptionsOverride> SavedStack; + }; + void resetFPOptions(FPOptions FPO) { CurFPFeatures = FPO; FpPragmaStack.Stack.clear();
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits