[llvm-commits] [cfe-commits] [PATCH] [Valgrind][check-clang] Optional.h: Appease Valgrind

Argyrios Kyrtzidis akyrtzi at gmail.com
Fri Dec 14 10:38:24 PST 2012


This looks like 'hasVal' can be bool, and Optional<T> specialized to contain a PointerIntPair if T is pointer; any objections ?

On Dec 14, 2012, at 9:02 AM, NAKAMURA Takumi <geek4civic at gmail.com> wrote:

> It seems small bitfield confuses valgrind.
> This patch makes a bitfiled to (valgrind-recognizable) i8 size.
> 
> I am using;
> valgrind-3.6.0 x86-64
> 
> It caused bunch of failures in clang/test/Modules with --vg.
> 
> http://llvm-reviews.chandlerc.com/D218
> 
> Files:
>  llvm/include/llvm/ADT/Optional.h
> 
> Index: llvm/include/llvm/ADT/Optional.h
> ===================================================================
> --- llvm/include/llvm/ADT/Optional.h
> +++ llvm/include/llvm/ADT/Optional.h
> @@ -28,7 +28,7 @@
> template<typename T>
> class Optional {
>   T x;
> -  unsigned hasVal : 1;
> +  unsigned char hasVal;
> public:
>   explicit Optional() : x(), hasVal(false) {}
>   Optional(const T &y) : x(y), hasVal(true) {}
> <D218.1.patch>_______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits





More information about the llvm-commits mailing list