From 3dc54a8c57bb7704d6a436adc84194ba9538b977 Mon Sep 17 00:00:00 2001
From: Zuzana Baranova <xbaranov@fi.muni.cz>
Date: Mon, 24 Jun 2019 19:51:22 +0000
Subject: [PATCH] CC: Put builtin headers into a stringtable to avoid mapping
 them individually.

---
 divine/cc/cc1.cpp     | 10 +++++-----
 divine/rt/runtime.cpp |  1 -
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/divine/cc/cc1.cpp b/divine/cc/cc1.cpp
index 5d951fde8..9c4ed07e2 100644
--- a/divine/cc/cc1.cpp
+++ b/divine/cc/cc1.cpp
@@ -32,10 +32,10 @@ DIVINE_UNRELAX_WARNINGS
 #include <divine/cc/cc1.hpp>
 #include <lart/divine/vaarg.h>
 
-namespace divine::str::cc
+namespace divine::str
 {
-    extern const std::string_view stddef_h;
-    extern const std::string_view stdarg_h;
+    struct stringtable { std::string n; std::string_view c; };
+    extern stringtable cc_list[];
 }
 
 namespace divine::cc
@@ -84,8 +84,8 @@ namespace divine::cc
         if ( !ctx )
             ctx.reset( new llvm::LLVMContext );
 
-        mapVirtualFile( "/builtin/stddef.h", ::divine::str::cc::stddef_h );
-        mapVirtualFile( "/builtin/stdarg.h", ::divine::str::cc::stdarg_h );
+        for ( auto src = str::cc_list; !src->n.empty(); ++src )
+            mapVirtualFile( brick::fs::joinPath( "/builtin/", src->n ), src->c );
     }
 
     CC1::~CC1() { }
diff --git a/divine/rt/runtime.cpp b/divine/rt/runtime.cpp
index 0e69c2e36..1965b0ccd 100644
--- a/divine/rt/runtime.cpp
+++ b/divine/rt/runtime.cpp
@@ -20,7 +20,6 @@
 
 namespace divine::str
 {
-
     struct stringtable { std::string n; std::string_view c; };
     extern stringtable dios_list[];
     namespace dios_native { extern std::string_view libdios_host_a, libc__abi_a, libc___a; }
-- 
GitLab