[PATCH] D18557: [Clang][ARM] __va_list declaration is not saved in ASTContext causing compilation error or crash

Oleg Ranevskyy via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 30 13:32:45 PDT 2016


iid_iunknown updated this revision to Diff 52114.
iid_iunknown added a comment.

The test enabled for all targets.


Repository:
  rL LLVM

http://reviews.llvm.org/D18557

Files:
  lib/AST/ASTContext.cpp
  test/PCH/Inputs/__va_list_tag-typedef.h
  test/PCH/__va_list_tag-typedef.c

Index: test/PCH/__va_list_tag-typedef.c
===================================================================
--- test/PCH/__va_list_tag-typedef.c
+++ test/PCH/__va_list_tag-typedef.c
@@ -0,0 +1,14 @@
+// This test checks the patch for the compilation error / crash described in D18557.
+
+// Test as a C source
+// RUN: %clang_cc1 -emit-pch -x c-header -o %t %S/Inputs/__va_list_tag-typedef.h
+// RUN: %clang_cc1 -fsyntax-only -include-pch %t %s
+
+// Test as a C++ source
+// RUN: %clang_cc1 -emit-pch -x c++-header -o %t %S/Inputs/__va_list_tag-typedef.h
+// RUN: %clang_cc1 -x c++ -fsyntax-only -include-pch %t %s
+
+// expected-no-diagnostics
+
+typedef __builtin_va_list va_list_2;
+void test(const char* format, ...) { va_list args; va_start( args, format ); }
Index: test/PCH/Inputs/__va_list_tag-typedef.h
===================================================================
--- test/PCH/Inputs/__va_list_tag-typedef.h
+++ test/PCH/Inputs/__va_list_tag-typedef.h
@@ -0,0 +1,4 @@
+// Header for PCH test __va_list_tag-typedef.c
+
+#include <stdarg.h>
+typedef va_list va_list_1;
Index: lib/AST/ASTContext.cpp
===================================================================
--- lib/AST/ASTContext.cpp
+++ lib/AST/ASTContext.cpp
@@ -6389,6 +6389,7 @@
 
   // };
   VaListDecl->completeDefinition();
+  Context->VaListTagDecl = VaListDecl;
 
   // typedef struct __va_list __builtin_va_list;
   QualType T = Context->getRecordType(VaListDecl);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18557.52114.patch
Type: text/x-patch
Size: 1475 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160330/d1c59971/attachment.bin>


More information about the cfe-commits mailing list