versioner: Add versioner_fortify_inline annotation

This commit adds versioner_fortify_inline annotation.  This annotation
indicates that the annotated function is an overloaded inline function
for _FORTIFY_SOURCE implementation.  They are usually enabled/disabled
by the enable_if attribute, thus the versioner don't have to check
whether they have conflicting definitions.

Bug: 118991081
Test: source development/vndk/tools/header-checker/android/envsetup.sh && \
      source build/envsetup.sh && \
      lunch aosp_arm64-userdebug && \
      m versioner && \
      ./bionic/tools/versioner/run_tests.py
Change-Id: If5c739fc0c8a218907855939c1fe5338134da7f7
diff --git a/tools/versioner/src/DeclarationDatabase.cpp b/tools/versioner/src/DeclarationDatabase.cpp
index 0ba51d1..afae509 100644
--- a/tools/versioner/src/DeclarationDatabase.cpp
+++ b/tools/versioner/src/DeclarationDatabase.cpp
@@ -106,6 +106,7 @@
     bool is_extern = named_decl->getFormalLinkage() == ExternalLinkage;
     bool is_definition = false;
     bool no_guard = false;
+    bool fortify_inline = false;
 
     if (auto function_decl = dyn_cast<FunctionDecl>(decl)) {
       is_definition = function_decl->isThisDeclarationADefinition();
@@ -147,6 +148,8 @@
       llvm::StringRef annotation = attr->getAnnotation();
       if (annotation == "versioner_no_guard") {
         no_guard = true;
+      } else if (annotation == "versioner_fortify_inline") {
+        fortify_inline = true;
       } else {
         llvm::SmallVector<llvm::StringRef, 2> fragments;
         annotation.split(fragments, "=");
@@ -217,7 +220,8 @@
         declaration_it != symbol_it->second.declarations.end()) {
       if (declaration_it->second.is_extern != is_extern ||
           declaration_it->second.is_definition != is_definition ||
-          declaration_it->second.no_guard != no_guard) {
+          declaration_it->second.no_guard != no_guard ||
+          declaration_it->second.fortify_inline != fortify_inline) {
         errx(1, "varying declaration of '%s' at %s:%u:%u", declaration_name.c_str(),
              location.filename.c_str(), location.start.line, location.start.column);
       }
@@ -229,6 +233,7 @@
       declaration.is_extern = is_extern;
       declaration.is_definition = is_definition;
       declaration.no_guard = no_guard;
+      declaration.fortify_inline = fortify_inline;
       declaration.availability.insert(std::make_pair(type, availability));
       symbol_it->second.declarations.insert(std::make_pair(location, declaration));
     }