[clang] [clang] Do not clear FP pragma stack when instantiating functions (PR #70646)

John McCall via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 9 11:43:57 PST 2023


================
@@ -710,9 +710,11 @@ class Sema final {
     return result;
   }
 
+  // Saves the current floating-point pragma stack and clear it in this Sema.
   class FpPragmaStackSaveRAII {
   public:
-    FpPragmaStackSaveRAII(Sema &S) : S(S), SavedStack(S.FpPragmaStack) {}
+    FpPragmaStackSaveRAII(Sema &S)
+        : S(S), SavedStack(std::move(S.FpPragmaStack)) {}
----------------
rjmccall wrote:

Does a move of `PragmaStack` guarantee to leave an empty stack?  I guess it's ultimately just a `SmallVector`, and it looks like `SmallVector` does currently make that guarantee.  That seems worth a comment or an assertion.

https://github.com/llvm/llvm-project/pull/70646


More information about the cfe-commits mailing list