Skip to content

Commit

Permalink
[clang] Upgrade to clang-17.0.1
Browse files Browse the repository at this point in the history
Summary:
This diff upgrades clang to 17.0.1. To make the builds successful, this diff did:

* Updated the line numbers of the patches,
* Revised the cmake options for clang to align with the latest documentation,
* Updated test results, esp. about coroutine.

Reviewed By: martintrojer

Differential Revision: D50736398

fbshipit-source-id: 20d8258910183b0ab1c308a01c0d62083d486be6
  • Loading branch information
skcho authored and facebook-github-bot committed Oct 30, 2023
1 parent 4b364c9 commit 72de3f8
Show file tree
Hide file tree
Showing 24 changed files with 171 additions and 160 deletions.
4 changes: 2 additions & 2 deletions facebook-clang-plugins/clang/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ if [[ "$PLATFORM" = "Linux" ]] && [[ -n "${PLATFORM_ENV}" ]] ; then
)
else
CMAKE_ARGS+=(
-DLLVM_ENABLE_PROJECTS="clang"
-DLLVM_ENABLE_RUNTIMES="compiler-rt;libcxx;libcxxabi;openmp"
-DLLVM_ENABLE_PROJECTS="clang;openmp"
-DLLVM_ENABLE_RUNTIMES="compiler-rt;libcxx;libcxxabi"
)
fi

Expand Down
2 changes: 1 addition & 1 deletion facebook-clang-plugins/clang/src/err_ret_local_block.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- a/llvm-project/clang/lib/Sema/SemaInit.cpp
+++ b/llvm-project/clang/lib/Sema/SemaInit.cpp
@@ -7147,7 +7147,9 @@ void Sema::checkInitializerLifetime(const InitializedEntity &Entity,
@@ -8258,7 +8258,9 @@ void Sema::checkInitializerLifetime(cons
<< Entity.getType()->isReferenceType() << DRE->getDecl()
<< isa<ParmVarDecl>(DRE->getDecl()) << DiagRange;
} else if (isa<BlockExpr>(L)) {
Expand Down
16 changes: 8 additions & 8 deletions facebook-clang-plugins/clang/src/mangle_suppress_errors.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- a/llvm-project/clang/lib/AST/ItaniumMangle.cpp
+++ b/llvm-project/clang/lib/AST/ItaniumMangle.cpp
@@ -1064,10 +1064,7 @@ void CXXNameMangler::mangleFloatLiteral(QualType T, const llvm::APFloat &V) {
@@ -1192,10 +1192,7 @@ void CXXNameMangler::mangleFloatLiteral(
}

void CXXNameMangler::mangleFixedPointLiteral() {
Expand All @@ -12,7 +12,7 @@
}

void CXXNameMangler::mangleNullPointer(QualType T) {
@@ -3270,11 +3267,7 @@ void CXXNameMangler::mangleNeonVectorType(const VectorType *T) {
@@ -3635,11 +3632,7 @@ void CXXNameMangler::mangleNeonVectorTyp
}

void CXXNameMangler::mangleNeonVectorType(const DependentVectorType *T) {
Expand All @@ -25,7 +25,7 @@
}

static StringRef mangleAArch64VectorBase(const BuiltinType *EltType) {
@@ -3347,11 +3340,7 @@ void CXXNameMangler::mangleAArch64NeonVectorType(const VectorType *T) {
@@ -3712,11 +3705,7 @@ void CXXNameMangler::mangleAArch64NeonVe
Out << TypeName.length() << TypeName;
}
void CXXNameMangler::mangleAArch64NeonVectorType(const DependentVectorType *T) {
Expand All @@ -38,7 +38,7 @@
}

// The AArch64 ACLE specifies that fixed-length SVE vector and predicate types
@@ -3444,11 +3433,7 @@ void CXXNameMangler::mangleAArch64FixedSveVectorType(const VectorType *T) {
@@ -3809,11 +3798,7 @@ void CXXNameMangler::mangleAArch64FixedS

void CXXNameMangler::mangleAArch64FixedSveVectorType(
const DependentVectorType *T) {
Expand All @@ -50,8 +50,8 @@
+ Out << "__unhandled_AArch64FixedSveVectorType";
}

// GNU extension: vector types
@@ -4040,12 +4025,7 @@ recurse:
void CXXNameMangler::mangleRISCVFixedRVVVectorType(const VectorType *T) {
@@ -4487,12 +4472,7 @@ recurse:
{
NotPrimaryExpr();
if (!NullOut) {
Expand All @@ -65,7 +65,7 @@
return;
}
break;
@@ -4081,12 +4061,7 @@ recurse:
@@ -4528,12 +4508,7 @@ recurse:
// Even gcc-4.5 doesn't mangle this.
case Expr::BinaryConditionalOperatorClass: {
NotPrimaryExpr();
Expand All @@ -79,7 +79,7 @@
return;
}

@@ -4425,18 +4400,11 @@ recurse:
@@ -4872,18 +4847,11 @@ recurse:
MangleAlignofSizeofArg();
break;
case UETT_VecStep: {
Expand Down
4 changes: 2 additions & 2 deletions facebook-clang-plugins/clang/src/prepare_clang_src.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SHASUM=${SHASUM:-shasum -a 256}
PATCH=${PATCH:-patch}

LLVM_VER="16.0.0"
LLVM_VER="17.0.1"
LLVM_URL="https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VER}/llvm-project-${LLVM_VER}.src.tar.xz"
LLVM_SHA="9a56d906a2c81f16f06efc493a646d497c53c2f4f28f0cb1f3c8da7f74350254"
LLVM_SHA="b0e42aafc01ece2ca2b42e3526f54bebc4b1f1dc8de6e34f46a0446a13e882b9"
LLVM_FILE="llvm-project.src.tar.xz"
CLANG_PREBUILD_PATCHES=(
"$SCRIPT_DIR/err_ret_local_block.patch"
Expand Down
15 changes: 12 additions & 3 deletions facebook-clang-plugins/libtooling/ASTExporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -4980,6 +4980,7 @@ int ASTExporter<ATDWriter>::BuiltinTypeTupleSize() {
IsSigned, \
IsFP, \
IsBF) //@atd | Id
#define SVE_OPAQUE_TYPE(Name, MangledName, Id, SingletonId) //@atd | Id
#include <clang/Basic/AArch64SVEACLETypes.def>
//@atd ]
template <class ATDWriter>
Expand All @@ -5004,6 +5005,11 @@ void ASTExporter<ATDWriter>::VisitBuiltinType(const BuiltinType *T) {
type_name = #Id; \
break; \
}
#define SVE_OPAQUE_TYPE(Name, MangledName, Id, SingletonId) \
case BuiltinType::Id: { \
type_name = #Id; \
break; \
}
#include <clang/Basic/AArch64SVEACLETypes.def>
#define IMAGE_TYPE(ImgType, ID, SingletonId, Access, Suffix) \
case BuiltinType::ID:
Expand All @@ -5014,6 +5020,9 @@ void ASTExporter<ATDWriter>::VisitBuiltinType(const BuiltinType *T) {
#include <clang/Basic/PPCTypes.def>
#define RVV_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
#include <clang/Basic/RISCVVTypes.def>
#define WASM_REF_TYPE(Name, MangledNameBase, Id, SingletonId, AS) \
case BuiltinType::Id:
#include <clang/Basic/WebAssemblyReferenceTypes.def>
llvm_unreachable("Unsupported types");
break;
}
Expand Down Expand Up @@ -5267,9 +5276,9 @@ void ASTExporter<ATDWriter>::VisitAttr(const Attr *A) {
//@atd } <ocaml field_prefix="vt_">
template <class ATDWriter>
void ASTExporter<ATDWriter>::dumpVersionTuple(const VersionTuple &VT) {
Optional<unsigned> minor = VT.getMinor();
Optional<unsigned> subminor = VT.getSubminor();
Optional<unsigned> build = VT.getBuild();
std::optional<unsigned> minor = VT.getMinor();
std::optional<unsigned> subminor = VT.getSubminor();
std::optional<unsigned> build = VT.getBuild();
ObjectScope Scope(
OF, 1 + minor.has_value() + subminor.has_value() + build.has_value());
OF.emitTag("major");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
tests/available_expression.m:8:12: warning: class 'NSObject' defined without specifying a base class [-Wobjc-root-class]
@interface NSObject
^
8 | @interface NSObject
| ^
tests/available_expression.m:8:20: note: add a super class to fix this problem
@interface NSObject
^
: NSObject
8 | @interface NSObject
| ^
| : NSObject
1 warning generated.
<#032016ff:
({ #d121c0bd: 1, #21793419: ({ }, { }) },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5664,9 +5664,9 @@
{ #f9c96be9: { #c1127ea9: 12, #298a4a8d: true } },
{ })>,
<#d3d219f7: ({ #d121c0bd: 191 }, { #c1127ea9: 187, #298a4a8d: true })>,
<#d80cb60b: ({ #d121c0bd: 22 }, 23)>,
<#26796f6a:
({ #d121c0bd: 192 }, { #f9c96be9: { #c1127ea9: 193 } }, { })>,
<#d80cb60b: ({ #d121c0bd: 22 }, 23)>,
<#f3f3711a: ({ #d121c0bd: 194 })>,
<#f3f3711a: ({ #d121c0bd: 195 })>,
<#09e09de9: ({ #d121c0bd: 196, #26f32be5: 195 })>,
Expand Down Expand Up @@ -5733,12 +5733,12 @@
({ #d121c0bd: 37 },
{ #f9c96be9: { #c1127ea9: 121 } },
{ #08ec7593: [ { #c1127ea9: 39 } ] })>,
<#d80cb60b: ({ #d121c0bd: 55 }, 56)>,
<#0b08cd60: ({ #d121c0bd: 61 }, { #c1127ea9: 12, #298a4a8d: true })>,
<#26796f6a:
({ #d121c0bd: 213 },
{ #f9c96be9: { #c1127ea9: 193 } },
{ #08ec7593: [ { #c1127ea9: 12, #298a4a8d: true } ] })>,
<#d80cb60b: ({ #d121c0bd: 55 }, 56)>,
<#0b08cd60: ({ #d121c0bd: 61 }, { #c1127ea9: 12, #298a4a8d: true })>,
<#f3f3711a: ({ #d121c0bd: 214 })>,
<#09e09de9: ({ #d121c0bd: 215, #26f32be5: 214 })>,
<#26796f6a:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5898,6 +5898,12 @@
"is_trivially_copyable" : true
}
]],
["RecordType" , [
{
"pointer" : 22
},
23
]],
["FunctionProtoType" , [
{
"pointer" : 192
Expand All @@ -5910,12 +5916,6 @@
{
}
]],
["RecordType" , [
{
"pointer" : 22
},
23
]],
["TemplateTypeParmType" , [
{
"pointer" : 194
Expand Down Expand Up @@ -6219,6 +6219,21 @@
]
}
]],
["RecordType" , [
{
"pointer" : 55
},
56
]],
["LValueReferenceType" , [
{
"pointer" : 61
},
{
"type_ptr" : 12,
"is_trivially_copyable" : true
}
]],
["FunctionProtoType" , [
{
"pointer" : 213
Expand All @@ -6237,21 +6252,6 @@
]
}
]],
["RecordType" , [
{
"pointer" : 55
},
56
]],
["LValueReferenceType" , [
{
"pointer" : 61
},
{
"type_ptr" : 12,
"is_trivially_copyable" : true
}
]],
["TemplateTypeParmType" , [
{
"pointer" : 214
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
tests/available_expression.m:8:12: warning: class 'NSObject' defined without specifying a base class [-Wobjc-root-class]
@interface NSObject
^
8 | @interface NSObject
| ^
tests/available_expression.m:8:20: note: add a super class to fix this problem
@interface NSObject
^
: NSObject
8 | @interface NSObject
| ^
| : NSObject
<"TranslationUnitDecl" : (
{
"pointer" : 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5898,6 +5898,12 @@
"is_trivially_copyable" : true
}
)>,
<"RecordType" : (
{
"pointer" : 22
},
23
)>,
<"FunctionProtoType" : (
{
"pointer" : 192
Expand All @@ -5910,12 +5916,6 @@
{
}
)>,
<"RecordType" : (
{
"pointer" : 22
},
23
)>,
<"TemplateTypeParmType" : (
{
"pointer" : 194
Expand Down Expand Up @@ -6219,6 +6219,21 @@
]
}
)>,
<"RecordType" : (
{
"pointer" : 55
},
56
)>,
<"LValueReferenceType" : (
{
"pointer" : 61
},
{
"type_ptr" : 12,
"is_trivially_copyable" : true
}
)>,
<"FunctionProtoType" : (
{
"pointer" : 213
Expand All @@ -6237,21 +6252,6 @@
]
}
)>,
<"RecordType" : (
{
"pointer" : 55
},
56
)>,
<"LValueReferenceType" : (
{
"pointer" : 61
},
{
"type_ptr" : 12,
"is_trivially_copyable" : true
}
)>,
<"TemplateTypeParmType" : (
{
"pointer" : 214
Expand Down
2 changes: 1 addition & 1 deletion infer/src/clang/ClangCommand.ml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ let filter_and_replace_unsupported_args ?(replace_options_arg = fun _ s -> s) ?(
let clang_cc1_cmd_sanitizer cmd =
let replace_args arg = function
| Some override_regex when Str.string_match override_regex arg 0 ->
Config.fcp_dir ^/ "clang" ^/ "install" ^/ "lib" ^/ "clang" ^/ "16.0.0" ^/ "include"
Config.fcp_dir ^/ "clang" ^/ "install" ^/ "lib" ^/ "clang" ^/ "17" ^/ "include"
| _ ->
arg
in
Expand Down
1 change: 1 addition & 0 deletions infer/src/clang/cTrans.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1175,6 +1175,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
| `AO__hip_atomic_compare_exchange_weak
| `AO__hip_atomic_exchange
| `AO__hip_atomic_fetch_add
| `AO__hip_atomic_fetch_sub
| `AO__hip_atomic_fetch_and
| `AO__hip_atomic_fetch_max
| `AO__hip_atomic_fetch_min
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ digraph cfg {


"main.fad58de7366495db_3" -> "main.fad58de7366495db_2" ;
"main.fad58de7366495db_4" [label="4: DeclStmt \n VARIABLE_DECLARED(s:std::basic_string<char,std::char_traits<char>,std::allocator<char>>); [line 18, column 3]\n n$3=_fun_std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string<nullptr_t>(&s:std::basic_string<char,std::char_traits<char>,std::allocator<char>>*,\"1234\":char const *) [line 18, column 15]\n " shape="box"]
"main.fad58de7366495db_4" [label="4: DeclStmt \n VARIABLE_DECLARED(s:std::basic_string<char,std::char_traits<char>,std::allocator<char>>); [line 18, column 3]\n n$3=_fun_std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string<0>(&s:std::basic_string<char,std::char_traits<char>,std::allocator<char>>*,\"1234\":char const *) [line 18, column 15]\n " shape="box"]


"main.fad58de7366495db_4" -> "main.fad58de7366495db_3" ;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ digraph cfg {


"main.fad58de7366495db_3" -> "main.fad58de7366495db_2" ;
"main.fad58de7366495db_4" [label="4: DeclStmt \n VARIABLE_DECLARED(s:std::basic_string<char,std::char_traits<char>,std::allocator<char>>); [line 18, column 3]\n n$3=_fun_std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string<nullptr_t>(&s:std::basic_string<char,std::char_traits<char>,std::allocator<char>>*,\"1234\":char const *) [line 18, column 15]\n " shape="box"]
"main.fad58de7366495db_4" [label="4: DeclStmt \n VARIABLE_DECLARED(s:std::basic_string<char,std::char_traits<char>,std::allocator<char>>); [line 18, column 3]\n n$3=_fun_std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string<0>(&s:std::basic_string<char,std::char_traits<char>,std::allocator<char>>*,\"1234\":char const *) [line 18, column 15]\n " shape="box"]


"main.fad58de7366495db_4" -> "main.fad58de7366495db_3" ;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ digraph cfg {


"main.fad58de7366495db_3" -> "main.fad58de7366495db_2" ;
"main.fad58de7366495db_4" [label="4: DeclStmt \n VARIABLE_DECLARED(s:std::basic_string<char,std::char_traits<char>,std::allocator<char>>); [line 18, column 3]\n n$3=_fun_std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string<nullptr_t>(&s:std::basic_string<char,std::char_traits<char>,std::allocator<char>>*,\"1234\":char const *) [line 18, column 15]\n " shape="box"]
"main.fad58de7366495db_4" [label="4: DeclStmt \n VARIABLE_DECLARED(s:std::basic_string<char,std::char_traits<char>,std::allocator<char>>); [line 18, column 3]\n n$3=_fun_std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string<0>(&s:std::basic_string<char,std::char_traits<char>,std::allocator<char>>*,\"1234\":char const *) [line 18, column 15]\n " shape="box"]


"main.fad58de7366495db_4" -> "main.fad58de7366495db_3" ;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ digraph cfg {


"main.fad58de7366495db_3" -> "main.fad58de7366495db_2" ;
"main.fad58de7366495db_4" [label="4: DeclStmt \n VARIABLE_DECLARED(s:std::basic_string<char,std::char_traits<char>,std::allocator<char>>); [line 18, column 3]\n n$3=_fun_std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string<nullptr_t>(&s:std::basic_string<char,std::char_traits<char>,std::allocator<char>>*,\"1234\":char const *) [line 18, column 15]\n " shape="box"]
"main.fad58de7366495db_4" [label="4: DeclStmt \n VARIABLE_DECLARED(s:std::basic_string<char,std::char_traits<char>,std::allocator<char>>); [line 18, column 3]\n n$3=_fun_std::basic_string<char,std::char_traits<char>,std::allocator<char>>::basic_string<0>(&s:std::basic_string<char,std::char_traits<char>,std::allocator<char>>*,\"1234\":char const *) [line 18, column 15]\n " shape="box"]


"main.fad58de7366495db_4" -> "main.fad58de7366495db_3" ;
Expand Down
Loading

0 comments on commit 72de3f8

Please sign in to comment.