Skip to content

Merge bastille into main #2252

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 36 commits into from
Dec 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
b618cf7
[lldb] GetSharedModule: Collect old modules in SmallVector
JosephTremoulet Oct 30, 2020
abeec5d
[lldb] Report old modules from ModuleList::ReplaceEquivalent
JosephTremoulet Oct 30, 2020
ca8de9a
[X86] Fix crash with i64 bitreverse on 32-bit targets with XOP.
topperc Nov 16, 2020
9f3874d
Merge commit 'ca8de9ad8895' from llvm.org/release/11.x into apple/sta…
Dec 15, 2020
fc23bc9
[SemaTemplate] Stop passing insertion position around during VarTempl…
bcardosolopes Oct 12, 2020
573e532
Merge commit 'fc23bc9b30bf' from llvm.org/release/11.x into apple/sta…
Dec 15, 2020
934376d
[NFC][InstCombine] Add test coverage for @llvm.uadd.sat canonicalization
LebedevRI Dec 9, 2020
9caf3bc
Merge commit '934376da5851' from llvm.org/release/11.x into apple/sta…
Dec 15, 2020
8511a8d
[InstCombine] canonicalizeSaturatedAdd(): last fold is only valid for…
LebedevRI Dec 9, 2020
a06e72d
Merge commit '8511a8df838f' from llvm.org/release/11.x into apple/sta…
Dec 15, 2020
861b2a2
[KernelAddressSanitizer] Fix globals exclusion for indirect aliases
melver Dec 11, 2020
d48c7ba
Merge commit '861b2a24bc49' from llvm.org/release/11.x into apple/sta…
Dec 15, 2020
700baa0
[MC][ELF] Accept abbreviated form with sh_flags and sh_entsize
tob2 Dec 11, 2020
e542042
Merge commit '700baa009dc6' from llvm.org/release/11.x into apple/sta…
Dec 15, 2020
8760017
Merge commit 'b618cf7a378d' from llvm.org/release/11.x into apple/sta…
jasonmolenda Dec 14, 2020
0d24554
Merge commit 'b618cf7a378d' from llvm.org/release/11.x into apple/sta…
Dec 15, 2020
f7d2d6b
Merge commit 'abeec5d081f0' from llvm.org/release/11.x into apple/sta…
Dec 15, 2020
200eb1a
Stop ExtractTypeForDeductionGuide from recursing on TypeSourceInfo
Dec 7, 2020
2ddc39c
Merge commit '200eb1abe2a1' from llvm.org/release/11.x into apple/sta…
Dec 15, 2020
adf8453
[Sema] Introduce BuiltinAttr, per-declaration builtin-ness
tambry Sep 4, 2020
fdab756
[Sema] Handle objc_super special lookup when checking builtin compati…
tambry Sep 18, 2020
1c923dd
Merge commit 'adf845300c9c' from llvm.org/release/11.x into apple/sta…
Dec 15, 2020
0312bec
Recognize setjmp and friends as builtins even if jmp_buf is not decla…
zygoloid Sep 29, 2020
a4f2caf
Merge commit 'fdab756331f3' from llvm.org/release/11.x into apple/sta…
Dec 15, 2020
98f575f
Don't reject calls to MinGW's unusual _setjmp declaration.
zygoloid Oct 2, 2020
3cd8d60
Merge commit '0312bec0d757' from llvm.org/release/11.x into apple/sta…
Dec 15, 2020
a3a3539
Merge commit '98f575ff55bf' from llvm.org/release/11.x into apple/sta…
Dec 15, 2020
b50fbe8
Revert "Merge commit 'b618cf7a378d' from llvm.org/release/11.x into a…
JDevlieghere Dec 15, 2020
72c3f6f
Revert "[lldb] Report old modules from ModuleList::ReplaceEquivalent"
JDevlieghere Dec 15, 2020
e70a527
Merge pull request #2242 from JDevlieghere/llvm.org-release-11.x
shahmishal Dec 15, 2020
95dcfb5
[lldb/API] Expose Target::CreateBreakpoint(..., move_to_nearest_code)…
medismailben Dec 15, 2020
9e6927b
Merge pull request #2243 from medismailben/apple/stable/20200714
medismailben Dec 15, 2020
5c30b2e
[sanitizer] Restrict querying VM size on Darwin only to iOS devices
kubamracek Dec 14, 2020
a18c6d8
[LLDB] Fix handling of bit-fields in a union
shafik Nov 12, 2020
58e662c
Merge pull request #2248 from shafik/70596991_fix_handling_bitfields_…
shafik Dec 15, 2020
634fc82
Merge remote-tracking branch 'origin/apple/stable/20200714' into swif…
JDevlieghere Dec 16, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions clang/include/clang/Basic/Attr.td
Original file line number Diff line number Diff line change
Expand Up @@ -3594,3 +3594,11 @@ def ReleaseHandle : InheritableParamAttr {
let Subjects = SubjectList<[ParmVar]>;
let Documentation = [ReleaseHandleDocs];
}

def Builtin : InheritableAttr {
let Spellings = [];
let Args = [UnsignedArgument<"ID">];
let Subjects = SubjectList<[Function]>;
let SemaHandler = 0;
let Documentation = [Undocumented];
}
27 changes: 16 additions & 11 deletions clang/include/clang/Basic/Builtins.def
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@
// U -> pure
// c -> const
// t -> signature is meaningless, use custom typechecking
// T -> type is not important to semantic analysis and codegen; recognize as
// builtin even if type doesn't match signature, and don't warn if we
// can't be sure the type is right
// F -> this is a libc/libm function with a '__builtin_' prefix added.
// f -> this is a libc/libm function without the '__builtin_' prefix. It can
// be followed by ':headername:' to state which header this function
Expand Down Expand Up @@ -893,7 +896,7 @@ LANGBUILTIN(__va_start, "vc**.", "nt", ALL_MS_LANGUAGES)
LANGBUILTIN(__fastfail, "vUi", "nr", ALL_MS_LANGUAGES)

// Microsoft library builtins.
LIBBUILTIN(_setjmpex, "iJ", "fj", "setjmpex.h", ALL_MS_LANGUAGES)
LIBBUILTIN(_setjmpex, "iJ", "fjT", "setjmpex.h", ALL_MS_LANGUAGES)

// C99 library functions
// C99 stdarg.h
Expand Down Expand Up @@ -987,8 +990,8 @@ LIBBUILTIN(wmemmove,"w*w*wC*z", "f", "wchar.h", ALL_LANGUAGES)
// In some systems setjmp is a macro that expands to _setjmp. We undefine
// it here to avoid having two identical LIBBUILTIN entries.
#undef setjmp
LIBBUILTIN(setjmp, "iJ", "fj", "setjmp.h", ALL_LANGUAGES)
LIBBUILTIN(longjmp, "vJi", "fr", "setjmp.h", ALL_LANGUAGES)
LIBBUILTIN(setjmp, "iJ", "fjT", "setjmp.h", ALL_LANGUAGES)
LIBBUILTIN(longjmp, "vJi", "frT", "setjmp.h", ALL_LANGUAGES)

// Non-C library functions, active in GNU mode only.
// Functions with (returns_twice) attribute (marked as "j") are still active in
Expand All @@ -1015,20 +1018,22 @@ LIBBUILTIN(strcasecmp, "icC*cC*", "f", "strings.h", ALL_GNU_LANGUAGES)
LIBBUILTIN(strncasecmp, "icC*cC*z", "f", "strings.h", ALL_GNU_LANGUAGES)
// POSIX unistd.h
LIBBUILTIN(_exit, "vi", "fr", "unistd.h", ALL_GNU_LANGUAGES)
LIBBUILTIN(vfork, "p", "fj", "unistd.h", ALL_LANGUAGES)
LIBBUILTIN(vfork, "p", "fjT", "unistd.h", ALL_LANGUAGES)
// POSIX pthread.h
// FIXME: Should specify argument types.
LIBBUILTIN(pthread_create, "", "fC<2,3>", "pthread.h", ALL_GNU_LANGUAGES)

// POSIX setjmp.h

LIBBUILTIN(_setjmp, "iJ", "fj", "setjmp.h", ALL_LANGUAGES)
LIBBUILTIN(__sigsetjmp, "iSJi", "fj", "setjmp.h", ALL_LANGUAGES)
LIBBUILTIN(sigsetjmp, "iSJi", "fj", "setjmp.h", ALL_LANGUAGES)
LIBBUILTIN(savectx, "iJ", "fj", "setjmp.h", ALL_LANGUAGES)
LIBBUILTIN(getcontext, "iK*", "fj", "setjmp.h", ALL_LANGUAGES)
// FIXME: MinGW _setjmp has an additional void* parameter.
LIBBUILTIN(_setjmp, "iJ", "fjT", "setjmp.h", ALL_LANGUAGES)
LIBBUILTIN(__sigsetjmp, "iSJi", "fjT", "setjmp.h", ALL_LANGUAGES)
LIBBUILTIN(sigsetjmp, "iSJi", "fjT", "setjmp.h", ALL_LANGUAGES)
LIBBUILTIN(savectx, "iJ", "fjT", "setjmp.h", ALL_LANGUAGES)
LIBBUILTIN(getcontext, "iK*", "fjT", "setjmp.h", ALL_LANGUAGES)

LIBBUILTIN(_longjmp, "vJi", "fr", "setjmp.h", ALL_GNU_LANGUAGES)
LIBBUILTIN(siglongjmp, "vSJi", "fr", "setjmp.h", ALL_GNU_LANGUAGES)
LIBBUILTIN(_longjmp, "vJi", "frT", "setjmp.h", ALL_GNU_LANGUAGES)
LIBBUILTIN(siglongjmp, "vSJi", "frT", "setjmp.h", ALL_GNU_LANGUAGES)
// non-standard but very common
LIBBUILTIN(strlcpy, "zc*cC*z", "f", "string.h", ALL_GNU_LANGUAGES)
LIBBUILTIN(strlcat, "zc*cC*z", "f", "string.h", ALL_GNU_LANGUAGES)
Expand Down
7 changes: 7 additions & 0 deletions clang/include/clang/Basic/Builtins.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,13 @@ class Context {
return strchr(getRecord(ID).Attributes, 't') != nullptr;
}

/// Determines whether a declaration of this builtin should be recognized
/// even if the type doesn't match the specified signature.
bool allowTypeMismatch(unsigned ID) const {
return strchr(getRecord(ID).Attributes, 'T') != nullptr ||
hasCustomTypechecking(ID);
}

/// Determines whether this builtin has a result or any arguments which
/// are pointer types.
bool hasPtrArgsOrResult(unsigned ID) const {
Expand Down
12 changes: 0 additions & 12 deletions clang/include/clang/Basic/IdentifierTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,18 +221,6 @@ class alignas(IdentifierInfoAlignment) IdentifierInfo {
}
void setObjCKeywordID(tok::ObjCKeywordKind ID) { ObjCOrBuiltinID = ID; }

/// True if setNotBuiltin() was called.
bool hasRevertedBuiltin() const {
return ObjCOrBuiltinID == tok::NUM_OBJC_KEYWORDS;
}

/// Revert the identifier to a non-builtin identifier. We do this if
/// the name of a known builtin library function is used to declare that
/// function, but an unexpected type is specified.
void revertBuiltin() {
setBuiltinID(0);
}

/// Return a value indicating whether this is a builtin function.
///
/// 0 is not-built-in. 1+ are specific builtin functions.
Expand Down
2 changes: 2 additions & 0 deletions clang/include/clang/Sema/Sema.h
Original file line number Diff line number Diff line change
Expand Up @@ -3990,6 +3990,8 @@ class Sema final {
ObjCInterfaceDecl *getObjCInterfaceDecl(IdentifierInfo *&Id,
SourceLocation IdLoc,
bool TypoCorrection = false);
FunctionDecl *CreateBuiltin(IdentifierInfo *II, QualType Type, unsigned ID,
SourceLocation Loc);
NamedDecl *LazilyCreateBuiltin(IdentifierInfo *II, unsigned ID,
Scope *S, bool ForRedeclaration,
SourceLocation Loc);
Expand Down
28 changes: 4 additions & 24 deletions clang/lib/AST/Decl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3163,44 +3163,24 @@ FunctionDecl *FunctionDecl::getCanonicalDecl() { return getFirstDecl(); }
/// functions as their wrapped builtins. This shouldn't be done in general, but
/// it's useful in Sema to diagnose calls to wrappers based on their semantics.
unsigned FunctionDecl::getBuiltinID(bool ConsiderWrapperFunctions) const {
unsigned BuiltinID;
unsigned BuiltinID = 0;

if (const auto *ABAA = getAttr<ArmBuiltinAliasAttr>()) {
BuiltinID = ABAA->getBuiltinName()->getBuiltinID();
} else {
if (!getIdentifier())
return 0;

BuiltinID = getIdentifier()->getBuiltinID();
} else if (const auto *A = getAttr<BuiltinAttr>()) {
BuiltinID = A->getID();
}

if (!BuiltinID)
return 0;

ASTContext &Context = getASTContext();
if (Context.getLangOpts().CPlusPlus) {
const auto *LinkageDecl =
dyn_cast<LinkageSpecDecl>(getFirstDecl()->getDeclContext());
// In C++, the first declaration of a builtin is always inside an implicit
// extern "C".
// FIXME: A recognised library function may not be directly in an extern "C"
// declaration, for instance "extern "C" { namespace std { decl } }".
if (!LinkageDecl) {
if (BuiltinID == Builtin::BI__GetExceptionInfo &&
Context.getTargetInfo().getCXXABI().isMicrosoft())
return Builtin::BI__GetExceptionInfo;
return 0;
}
if (LinkageDecl->getLanguage() != LinkageSpecDecl::lang_c)
return 0;
}

// If the function is marked "overloadable", it has a different mangled name
// and is not the C library function.
if (!ConsiderWrapperFunctions && hasAttr<OverloadableAttr>() &&
!hasAttr<ArmBuiltinAliasAttr>())
return 0;

ASTContext &Context = getASTContext();
if (!Context.BuiltinInfo.isPredefinedLibFunction(BuiltinID))
return BuiltinID;

Expand Down
6 changes: 4 additions & 2 deletions clang/lib/CodeGen/CGBuiltin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3827,11 +3827,13 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
case Builtin::BI_abnormal_termination:
return RValue::get(EmitSEHAbnormalTermination());
case Builtin::BI_setjmpex:
if (getTarget().getTriple().isOSMSVCRT())
if (getTarget().getTriple().isOSMSVCRT() && E->getNumArgs() == 1 &&
E->getArg(0)->getType()->isPointerType())
return EmitMSVCRTSetJmp(*this, MSVCSetJmpKind::_setjmpex, E);
break;
case Builtin::BI_setjmp:
if (getTarget().getTriple().isOSMSVCRT()) {
if (getTarget().getTriple().isOSMSVCRT() && E->getNumArgs() == 1 &&
E->getArg(0)->getType()->isPointerType()) {
if (getTarget().getTriple().getArch() == llvm::Triple::x86)
return EmitMSVCRTSetJmp(*this, MSVCSetJmpKind::_setjmp3, E);
else if (getTarget().getTriple().getArch() == llvm::Triple::aarch64)
Expand Down
Loading