[cfe-commits] r125474 - in /cfe/trunk: include/clang/Basic/LangOptions.h include/clang/Parse/Parser.h include/clang/Sema/Sema.h lib/Lex/Pragma.cpp lib/Parse/ParsePragma.cpp lib/Parse/ParsePragma.h lib/Parse/Parser.cpp lib/Sema/Sema.cpp lib/Sema/SemaAttr.cpp

Douglas Gregor dgregor at apple.com
Mon Feb 14 08:53:59 PST 2011


On Feb 13, 2011, at 5:42 PM, Peter Collingbourne wrote:

> Author: pcc
> Date: Sun Feb 13 19:42:35 2011
> New Revision: 125474
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=125474&view=rev
> Log:
> Move support for "#pragma STDC FP_CONTRACT" to Parser; add Sema actions

A few comments below.

> Modified:
>    cfe/trunk/include/clang/Basic/LangOptions.h
>    cfe/trunk/include/clang/Parse/Parser.h
>    cfe/trunk/include/clang/Sema/Sema.h
>    cfe/trunk/lib/Lex/Pragma.cpp
>    cfe/trunk/lib/Parse/ParsePragma.cpp
>    cfe/trunk/lib/Parse/ParsePragma.h
>    cfe/trunk/lib/Parse/Parser.cpp
>    cfe/trunk/lib/Sema/Sema.cpp
>    cfe/trunk/lib/Sema/SemaAttr.cpp
> 
> Modified: cfe/trunk/include/clang/Basic/LangOptions.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.h?rev=125474&r1=125473&r2=125474&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/LangOptions.h (original)
> +++ cfe/trunk/include/clang/Basic/LangOptions.h Sun Feb 13 19:42:35 2011
> @@ -118,6 +118,7 @@
>                                          // single precision constants.
>   unsigned FastRelaxedMath : 1; // OpenCL fast relaxed math (on its own,
>                                 // defines __FAST_RELAXED_MATH__).
> +  unsigned DefaultFPContract : 1; // Default setting for FP_CONTRACT
>   // FIXME: This is just a temporary option, for testing purposes.
>   unsigned NoBitFieldTypeAlign : 1;
> 
> @@ -210,6 +211,7 @@
>     SpellChecking = 1;
>     SinglePrecisionConstants = 0;
>     FastRelaxedMath = 0;
> +    DefaultFPContract = 0;
>     NoBitFieldTypeAlign = 0;
>   }
> 
> @@ -236,6 +238,17 @@
>   }
> };
> 
> +/// Floating point control options
> +class FPOptions {
> +public:
> +  unsigned fp_contract : 1;
> +
> +  FPOptions() : fp_contract(0) {}
> +
> +  FPOptions(const LangOptions &LangOpts) :
> +    fp_contract(LangOpts.DefaultFPContract) {}
> +};
> +
> }  // end namespace clang
> 
> #endif

Please add AST serialization and deserialization for FPOptions to ASTWriter/ASTReader.

Is there no way we can test this code?

	- Doug



More information about the cfe-commits mailing list