@@ -54,7 +54,6 @@ static constexpr llvm::StringLiteral PRE_CONDITION_ATTR_PREFIX("ia2_pre_conditio
5454static constexpr llvm::StringLiteral POST_CONDITION_ATTR_PREFIX (" ia2_post_condition:" );
5555static constexpr llvm::StringLiteral CONSTRUCTOR_ATTR (" ia2_constructor" );
5656static constexpr llvm::StringLiteral DESTRUCTOR_ATTR (" ia2_destructor" );
57- static constexpr llvm::StringLiteral EXTERN_PKEY_ATTR_PREFIX (" ia2_extern_pkey:" );
5857
5958typedef std::string Filename;
6059typedef int Pkey;
@@ -193,24 +192,6 @@ static std::string append_name_if_nonempty(const std::string &new_type,
193192 return new_type + (name.empty () ? " " : " " ) + name;
194193};
195194
196- static std::optional<Pkey> get_annotated_extern_pkey (const clang::Decl &decl) {
197- for (const auto *attr : decl.attrs ()) {
198- if (const auto *annotate_attr = llvm::dyn_cast<clang::AnnotateAttr>(attr)) {
199- llvm::StringRef annotation = annotate_attr->getAnnotation ();
200- if (!annotation.consume_front (EXTERN_PKEY_ATTR_PREFIX )) {
201- continue ;
202- }
203- Pkey pkey = 0 ;
204- if (annotation.getAsInteger (10 , pkey)) {
205- llvm::errs () << " invalid ia2_extern_pkey annotation on declaration\n " ;
206- abort ();
207- }
208- return pkey;
209- }
210- }
211- return std::nullopt ;
212- }
213-
214195// / Collects in a multimap (`funcs`) all of the function names
215196// / with an annotation starting with `prefix`.
216197// / The annotation minus the prefix is the key,
@@ -1004,15 +985,12 @@ class FnDecl : public RefactoringCallback {
1004985 return ;
1005986 }
1006987
1007- auto annotated_extern_pkey = get_annotated_extern_pkey (*fn_node);
1008-
1009988 // Skip if we should ignore (but still track system library declarations).
1010989 // Also allow ld.so functions coming from the stub TU: we never rewrite that
1011990 // file, but we must harvest its prototypes so DetermineAbi/emit_asm_wrapper
1012991 // have ABI-correct signatures when synthesizing loader call gates.
1013992 bool is_ldso = gLibcCompartmentEnabled && LdsoFunctionRegistry::is_ldso_function (fn_name);
1014- if (!is_system_header && !is_ldso && !annotated_extern_pkey &&
1015- ignore_function (*fn_node, fn_node->getLocation (), sm)) {
993+ if (!is_system_header && !is_ldso && ignore_function (*fn_node, fn_node->getLocation (), sm)) {
1016994 return ;
1017995 }
1018996
@@ -1055,9 +1033,6 @@ class FnDecl : public RefactoringCallback {
10551033 fn_definitions[fn_name] = filename;
10561034 } else {
10571035 declared_fns[pkey].insert (fn_name);
1058- if (annotated_extern_pkey) {
1059- fn_pkeys[fn_name] = *annotated_extern_pkey;
1060- }
10611036
10621037 // Track if this is from a system header for later use
10631038 if (fn_node && sm.isInSystemHeader (fn_node->getLocation ())) {
0 commit comments