aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.h
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2020-05-16 14:44:54 -0400
committerJohn McCall <rjmccall@apple.com>2020-05-16 14:44:54 -0400
commit32870a84d9a40ea682e22a24b5f0d1a218c3b062 (patch)
treec475c4cde3b66e7723dd54571e92cf088f2c3b29 /clang/lib/CodeGen/CodeGenModule.h
parent49c9a68d7fc62aabdf4d625fcb2954555496772b (diff)
downloadllvm-32870a84d9a40ea682e22a24b5f0d1a218c3b062.zip
llvm-32870a84d9a40ea682e22a24b5f0d1a218c3b062.tar.gz
llvm-32870a84d9a40ea682e22a24b5f0d1a218c3b062.tar.bz2
Expose IRGen API to add the default IR attributes to a function definition.
I've also made a stab at imposing some more order on where and how we add attributes; this part should be NFC. I wasn't sure whether the CUDA use case for libdevice should propagate CPU/features attributes, so there's a bit of unnecessary duplication.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.h')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.h17
1 files changed, 11 insertions, 6 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h
index 2408ac3..370fcec 100644
--- a/clang/lib/CodeGen/CodeGenModule.h
+++ b/clang/lib/CodeGen/CodeGenModule.h
@@ -1170,7 +1170,11 @@ public:
/// on the function more conservative. But it's unsafe to call this on a
/// function which relies on particular fast-math attributes for correctness.
/// It's up to you to ensure that this is safe.
- void AddDefaultFnAttrs(llvm::Function &F);
+ void addDefaultFunctionDefinitionAttributes(llvm::Function &F);
+
+ /// Like the overload taking a `Function &`, but intended specifically
+ /// for frontends that want to build on Clang's target-configuration logic.
+ void addDefaultFunctionDefinitionAttributes(llvm::AttrBuilder &attrs);
StringRef getMangledName(GlobalDecl GD);
StringRef getBlockMangledName(GlobalDecl GD, const BlockDecl *BD);
@@ -1532,11 +1536,12 @@ private:
/// function.
void SimplifyPersonality();
- /// Helper function for ConstructAttributeList and AddDefaultFnAttrs.
- /// Constructs an AttrList for a function with the given properties.
- void ConstructDefaultFnAttrList(StringRef Name, bool HasOptnone,
- bool AttrOnCallSite,
- llvm::AttrBuilder &FuncAttrs);
+ /// Helper function for ConstructAttributeList and
+ /// addDefaultFunctionDefinitionAttributes. Builds a set of function
+ /// attributes to add to a function with the given properties.
+ void getDefaultFunctionAttributes(StringRef Name, bool HasOptnone,
+ bool AttrOnCallSite,
+ llvm::AttrBuilder &FuncAttrs);
llvm::Metadata *CreateMetadataIdentifierImpl(QualType T, MetadataTypeMap &Map,
StringRef Suffix);