]> granicus.if.org Git - clang/commitdiff
[OpenCL] Make TableGen'd builtin tables and helper functions static
authorTom Stellard <tstellar@redhat.com>
Mon, 15 Jul 2019 22:34:19 +0000 (22:34 +0000)
committerTom Stellard <tstellar@redhat.com>
Mon, 15 Jul 2019 22:34:19 +0000 (22:34 +0000)
Reviewers: Pierre, Anastasia

Reviewed By: Anastasia

Subscribers: yaxunl, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D64608

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@366143 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaLookup.cpp
utils/TableGen/ClangOpenCLBuiltinEmitter.cpp

index c0b946a98d1dce55bda89741ea2b3cae65faa29a..8a24dd884a76ab9d3128fbd8a5b0f9db5816e419 100644 (file)
@@ -688,7 +688,7 @@ static void InsertOCLBuiltinDeclarations(Sema &S, LookupResult &LR,
                                          unsigned Len) {
 
   for (unsigned i = 0; i < Len; ++i) {
-    OpenCLBuiltinDecl &Decl = OpenCLBuiltins[Index - 1 + i];
+    const OpenCLBuiltinDecl &Decl = OpenCLBuiltins[Index - 1 + i];
     ASTContext &Context = S.Context;
 
     // Ignore this BIF if the version is incorrect.
index 1e495039c494c804212e741a165500fda299b412..8d83b1c7fa6b93c7405d0bfd5be1a4685918713b 100644 (file)
@@ -207,7 +207,7 @@ void BuiltinNameEmitter::GetOverloads() {
 }
 
 void BuiltinNameEmitter::EmitSignatureTable() {
-  OS << "OpenCLType OpenCLSignature[] = {\n";
+  OS << "static const OpenCLType OpenCLSignature[] = {\n";
   for (auto &P : SignatureSet) {
     OS << "// " << P.second << "\n";
     for (Record *R : P.first) {
@@ -222,7 +222,7 @@ void BuiltinNameEmitter::EmitSignatureTable() {
 }
 
 void BuiltinNameEmitter::EmitBuiltinTable() {
-  OS << "OpenCLBuiltinDecl OpenCLBuiltins[] = {\n";
+  OS << "static const OpenCLBuiltinDecl OpenCLBuiltins[] = {\n";
   for (auto &i : OverloadInfo) {
     StringRef Name = i.first;
     OS << "// " << Name << "\n";
@@ -255,7 +255,7 @@ void BuiltinNameEmitter::EmitStringMatcher() {
   OS << R"(
 // Return 0 if name is not a recognized OpenCL builtin, or an index
 // into a table of declarations if it is an OpenCL builtin.
-std::pair<unsigned, unsigned> isOpenCLBuiltin(llvm::StringRef name) {
+static std::pair<unsigned, unsigned> isOpenCLBuiltin(llvm::StringRef name) {
 
 )";