llvm-project/clang/test/PCH/Inputs
Oleg Ranevskyy b88d2474df [Clang][ARM] __va_list declaration is not saved in ASTContext causing compilation error or crash
Summary:
When the code is compiled for arm32 and the builtin `__va_list` declaration is created by `CreateAAPCSABIBuiltinVaListDecl`, the declaration is not saved in the `ASTContext` which may lead to a compilation error or crash.

Minimal reproducer I was able to find:
**header.h**
```
#include <stdarg.h>
typedef va_list va_list_1;
```

**test.cpp**
```
typedef __builtin_va_list va_list_2;
void foo(const char* format, ...) { va_list args; va_start( args, format ); }
```

Steps to reproduce:
```
clang -x c++-header --target=armv7l-linux-eabihf header.h
clang -c -include header.h --target=armv7l-linux-eabihf test.cpp
```

Compilation error:
```
error: non-const lvalue reference to type '__builtin_va_list'
      cannot bind to a value of unrelated type 'va_list' (aka '__builtin_va_list')
```

Compiling the same code as a C source leads to a crash:
```
clang --target=armv7l-linux-eabihf header.h
clang -c -x c -include header.h --target=armv7l-linux-eabihf test.cpp
```

Reviewers: logan, rsmith

Subscribers: cfe-commits, asl, aemerson, rengolin

Differential Revision: http://reviews.llvm.org/D18557

llvm-svn: 264930
2016-03-30 21:30:30 +00:00
..
badpch-dir.h.gch
modules [PCH/Modules] Check that the specific module cache path the PCH was built with, is the same as 2015-02-19 20:12:20 +00:00
__va_list_tag-typedef.h [Clang][ARM] __va_list declaration is not saved in ASTContext causing compilation error or crash 2016-03-30 21:30:30 +00:00
__va_list_tag.h
arc.h
badpch-empty.h.gch
case-insensitive-include.h
chain-decls1.h
chain-decls2.h
chain-ext_vector1.h
chain-ext_vector2.h
chain-external-defs1.h
chain-external-defs2.h
chain-macro-override1.h
chain-macro-override2.h
chain-macro1.h
chain-macro2.h
chain-remap-types1.h
chain-remap-types2.h
chain-selectors1.h
chain-selectors2.h
chain-trivial1.h
chain-trivial2.h
cuda.h
cxx-method.h
cxx11-statement-attributes.h P0188R1: add support for standard [[fallthrough]] attribute. This is almost 2016-03-08 00:32:55 +00:00
namespaces.h
preamble.h
typo.h
typo.hpp
va_arg.h Support __builtin_ms_va_list. 2015-09-17 20:55:33 +00:00
working-directory-1.h