[clang] d7804e1 - [Clang] Move ParsedTargetAttr to TargetInfo.h

David Green via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 1 10:26:51 PDT 2022


Author: David Green
Date: 2022-10-01T18:26:42+01:00
New Revision: d7804e187a8fc90bde2c12e373aff85a1148b5e7

URL: https://github.com/llvm/llvm-project/commit/d7804e187a8fc90bde2c12e373aff85a1148b5e7
DIFF: https://github.com/llvm/llvm-project/commit/d7804e187a8fc90bde2c12e373aff85a1148b5e7.diff

LOG: [Clang] Move ParsedTargetAttr to TargetInfo.h

This moves the struct, as it is now parsed by TargetInfo, so avoiding
some includes of AST in Basic.

Added: 
    

Modified: 
    clang/include/clang/AST/Attr.h
    clang/include/clang/Basic/TargetInfo.h
    clang/lib/Basic/TargetInfo.cpp
    clang/lib/Basic/Targets/AArch64.cpp

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/AST/Attr.h b/clang/include/clang/AST/Attr.h
index ab64ef39f4b5..793732cd26b0 100644
--- a/clang/include/clang/AST/Attr.h
+++ b/clang/include/clang/AST/Attr.h
@@ -362,20 +362,6 @@ class ParamIdx {
 static_assert(sizeof(ParamIdx) == sizeof(ParamIdx::SerialType),
               "ParamIdx does not fit its serialization type");
 
-/// Contains information gathered from parsing the contents of TargetAttr.
-struct ParsedTargetAttr {
-  std::vector<std::string> Features;
-  StringRef CPU;
-  StringRef Tune;
-  StringRef BranchProtection;
-  StringRef Duplicate;
-  bool operator ==(const ParsedTargetAttr &Other) const {
-    return Duplicate == Other.Duplicate && CPU == Other.CPU &&
-           Tune == Other.Tune && BranchProtection == Other.BranchProtection &&
-           Features == Other.Features;
-  }
-};
-
 #include "clang/AST/Attrs.inc"
 
 inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB,

diff  --git a/clang/include/clang/Basic/TargetInfo.h b/clang/include/clang/Basic/TargetInfo.h
index d37d84d121d4..9b9439e2c34f 100644
--- a/clang/include/clang/Basic/TargetInfo.h
+++ b/clang/include/clang/Basic/TargetInfo.h
@@ -49,7 +49,20 @@ class DiagnosticsEngine;
 class LangOptions;
 class CodeGenOptions;
 class MacroBuilder;
-struct ParsedTargetAttr;
+
+/// Contains information gathered from parsing the contents of TargetAttr.
+struct ParsedTargetAttr {
+  std::vector<std::string> Features;
+  StringRef CPU;
+  StringRef Tune;
+  StringRef BranchProtection;
+  StringRef Duplicate;
+  bool operator ==(const ParsedTargetAttr &Other) const {
+    return Duplicate == Other.Duplicate && CPU == Other.CPU &&
+           Tune == Other.Tune && BranchProtection == Other.BranchProtection &&
+           Features == Other.Features;
+  }
+};
 
 namespace Builtin { struct Info; }
 

diff  --git a/clang/lib/Basic/TargetInfo.cpp b/clang/lib/Basic/TargetInfo.cpp
index a9a97c6e752e..833e37b325e6 100644
--- a/clang/lib/Basic/TargetInfo.cpp
+++ b/clang/lib/Basic/TargetInfo.cpp
@@ -11,7 +11,6 @@
 //===----------------------------------------------------------------------===//
 
 #include "clang/Basic/TargetInfo.h"
-#include "clang/AST/Attr.h"
 #include "clang/Basic/AddressSpaces.h"
 #include "clang/Basic/CharInfo.h"
 #include "clang/Basic/Diagnostic.h"

diff  --git a/clang/lib/Basic/Targets/AArch64.cpp b/clang/lib/Basic/Targets/AArch64.cpp
index a18e00f6f4f3..8c0f5dd66cd1 100644
--- a/clang/lib/Basic/Targets/AArch64.cpp
+++ b/clang/lib/Basic/Targets/AArch64.cpp
@@ -11,7 +11,6 @@
 //===----------------------------------------------------------------------===//
 
 #include "AArch64.h"
-#include "clang/AST/Attr.h"
 #include "clang/Basic/LangOptions.h"
 #include "clang/Basic/TargetBuiltins.h"
 #include "clang/Basic/TargetInfo.h"


        


More information about the cfe-commits mailing list