Update prebuilt Clang to match Android kernel.
Bug: 132428451
Change-Id: I8f6e2cb23f381fc0c02ddea99b867e58e925e5be
diff --git a/linux-x64/clang/include/llvm/IR/Module.h b/linux-x64/clang/include/llvm/IR/Module.h
index 91e44ad..7373b84 100644
--- a/linux-x64/clang/include/llvm/IR/Module.h
+++ b/linux-x64/clang/include/llvm/IR/Module.h
@@ -1,9 +1,8 @@
//===- llvm/Module.h - C++ class to represent a VM module -------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -49,6 +48,7 @@
class RandomNumberGenerator;
template <class PtrType> class SmallPtrSetImpl;
class StructType;
+class VersionTuple;
/// A Module instance is used to store all the information related to an
/// LLVM module. Modules are the top level container of all other LLVM
@@ -332,16 +332,18 @@
/// Look up the specified function in the module symbol table. Four
/// possibilities:
/// 1. If it does not exist, add a prototype for the function and return it.
- /// 2. If it exists, and has a local linkage, the existing function is
- /// renamed and a new one is inserted.
- /// 3. Otherwise, if the existing function has the correct prototype, return
+ /// 2. Otherwise, if the existing function has the correct prototype, return
/// the existing function.
- /// 4. Finally, the function exists but has the wrong prototype: return the
+ /// 3. Finally, the function exists but has the wrong prototype: return the
/// function with a constantexpr cast to the right prototype.
- Constant *getOrInsertFunction(StringRef Name, FunctionType *T,
- AttributeList AttributeList);
+ ///
+ /// In all cases, the returned value is a FunctionCallee wrapper around the
+ /// 'FunctionType *T' passed in, as well as a 'Value*' either of the Function or
+ /// the bitcast to the function.
+ FunctionCallee getOrInsertFunction(StringRef Name, FunctionType *T,
+ AttributeList AttributeList);
- Constant *getOrInsertFunction(StringRef Name, FunctionType *T);
+ FunctionCallee getOrInsertFunction(StringRef Name, FunctionType *T);
/// Look up the specified function in the module symbol table. If it does not
/// exist, add a prototype for the function and return it. This function
@@ -349,11 +351,10 @@
/// or a ConstantExpr BitCast of that type if the named function has a
/// different type. This version of the method takes a list of
/// function arguments, which makes it easier for clients to use.
- template<typename... ArgsTy>
- Constant *getOrInsertFunction(StringRef Name,
- AttributeList AttributeList,
- Type *RetTy, ArgsTy... Args)
- {
+ template <typename... ArgsTy>
+ FunctionCallee getOrInsertFunction(StringRef Name,
+ AttributeList AttributeList, Type *RetTy,
+ ArgsTy... Args) {
SmallVector<Type*, sizeof...(ArgsTy)> ArgTys{Args...};
return getOrInsertFunction(Name,
FunctionType::get(RetTy, ArgTys, false),
@@ -361,11 +362,18 @@
}
/// Same as above, but without the attributes.
- template<typename... ArgsTy>
- Constant *getOrInsertFunction(StringRef Name, Type *RetTy, ArgsTy... Args) {
+ template <typename... ArgsTy>
+ FunctionCallee getOrInsertFunction(StringRef Name, Type *RetTy,
+ ArgsTy... Args) {
return getOrInsertFunction(Name, AttributeList{}, RetTy, Args...);
}
+ // Avoid an incorrect ordering that'd otherwise compile incorrectly.
+ template <typename... ArgsTy>
+ FunctionCallee
+ getOrInsertFunction(StringRef Name, AttributeList AttributeList,
+ FunctionType *Invalid, ArgsTy... Args) = delete;
+
/// Look up the specified function in the module symbol table. If it does not
/// exist, return null.
Function *getFunction(StringRef Name) const;
@@ -402,11 +410,15 @@
}
/// Look up the specified global in the module symbol table.
- /// 1. If it does not exist, add a declaration of the global and return it.
- /// 2. Else, the global exists but has the wrong type: return the function
- /// with a constantexpr cast to the right type.
- /// 3. Finally, if the existing global is the correct declaration, return
- /// the existing global.
+ /// If it does not exist, invoke a callback to create a declaration of the
+ /// global and return it. The global is constantexpr casted to the expected
+ /// type if necessary.
+ Constant *
+ getOrInsertGlobal(StringRef Name, Type *Ty,
+ function_ref<GlobalVariable *()> CreateGlobalCallback);
+
+ /// Look up the specified global in the module symbol table. If required, this
+ /// overload constructs the global variable using its constructor's defaults.
Constant *getOrInsertGlobal(StringRef Name, Type *Ty);
/// @}
@@ -868,6 +880,17 @@
/// Set that PLT should be avoid for RTLib calls.
void setRtLibUseGOT();
+ /// @name Utility functions for querying and setting the build SDK version
+ /// @{
+
+ /// Attach a build SDK version metadata to this module.
+ void setSDKVersion(const VersionTuple &V);
+
+ /// Get the build SDK version metadata.
+ ///
+ /// An empty version is returned if no such metadata is attached.
+ VersionTuple getSDKVersion() const;
+ /// @}
/// Take ownership of the given memory buffer.
void setOwnedMemoryBuffer(std::unique_ptr<MemoryBuffer> MB);