[clang] 14742f2 - [PowerPC] Truncate exponent parameter for vec_cts, vec_ctf

2023-07-11 Thread Zarko Todorovski via cfe-commits

Author: Zarko Todorovski
Date: 2023-07-11T11:52:07-04:00
New Revision: 14742f2a689c825adebc54cbade9c89fbe426da8

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

LOG: [PowerPC] Truncate exponent parameter for vec_cts,vec_ctf

On PowerPC, the vec_ct* builtin function take the form of eg. d=vec_cts(a,b)
LLVM (llc) will crash when a user specifies a number out of the allowed range
(0-31) for b.This patch truncates b so that we avoid the backend crash in some 
cases.

Further documentation for the builtins can be found here:
https://www.ibm.com/docs/en/xl-c-and-cpp-linux/16.1.0?topic=functions-vec-ctf
https://www.ibm.com/docs/en/xl-c-and-cpp-linux/16.1.0?topic=functions-vec-cts

Reviewed By: nemanjai, #powerpc

Differential Revision: https://reviews.llvm.org/D106409

Added: 
clang/test/CodeGen/ppc-vec_ct-truncate.c

Modified: 
clang/lib/Headers/altivec.h

Removed: 




diff  --git a/clang/lib/Headers/altivec.h b/clang/lib/Headers/altivec.h
index f50466ec9637f5..c036f5ebba580e 100644
--- a/clang/lib/Headers/altivec.h
+++ b/clang/lib/Headers/altivec.h
@@ -3202,71 +3202,79 @@ static __inline__ vector double __ATTRS_o_ai 
vec_cpsgn(vector double __a,
 // the XL-compatible signatures are used for those functions.
 #ifdef __XL_COMPAT_ALTIVEC__
 #define vec_ctf(__a, __b)  
\
-  _Generic(
\
-  (__a), vector int
\
-  : (vector float)__builtin_altivec_vcfsx((vector int)(__a), (__b)),   
\
-vector unsigned int
\
-  : (vector float)__builtin_altivec_vcfux((vector unsigned int)(__a),  
\
-  (__b)),  
\
-vector unsigned long long  
\
-  : (vector float)(__builtin_vsx_xvcvuxdsp(
\
-   (vector unsigned long long)(__a)) * 
\
-   (vector float)(vector unsigned)((0x7f - (__b)) << 23)), 
\
-vector signed long long
\
-  : (vector float)(__builtin_vsx_xvcvsxdsp(
\
-   (vector signed long long)(__a)) *   
\
-   (vector float)(vector unsigned)((0x7f - (__b)) << 23)))
+  _Generic((__a),  
\
+  vector int: (vector float)__builtin_altivec_vcfsx((vector int)(__a), 
\
+((__b)&0x1F)), 
\
+  vector unsigned int: (vector float)__builtin_altivec_vcfux(  
\
+   (vector unsigned int)(__a), ((__b)&0x1F)),  
\
+  vector unsigned long long: ( 
\
+   vector float)(__builtin_vsx_xvcvuxdsp(  
\
+ (vector unsigned long long)(__a)) *   
\
+ (vector float)(vector unsigned)((0x7f -   
\
+  ((__b)&0x1F))
\
+ << 23)),  
\
+  vector signed long long: (   
\
+   vector float)(__builtin_vsx_xvcvsxdsp(  
\
+ (vector signed long long)(__a)) * 
\
+ (vector float)(vector unsigned)((0x7f -   
\
+  ((__b)&0x1F))
\
+ << 23)))
 #else // __XL_COMPAT_ALTIVEC__
-#define vec_ctf(__a, __b)  
\
-  _Generic(
\
-  (__a), vector int
\
-  : (vector float)__builtin_altivec_vcfsx((vector int)(__a), (__b)),   
\
-vector unsigned int
\
-  : (vector float)__builtin_altivec_vcfux((vector unsigned int)(__a),  
\
-  (__b)),  
\
-vector unsigned long long  
\
-  : (vector float)(__builtin_convertvector(
\
-   (vector unsigned long long)(__a), vector double) *  
\
-

[clang] 99fe4d3 - Set EnableAIXExtendedAltivecABI in BackendUtils from LangOpts

2023-05-01 Thread Zarko Todorovski via cfe-commits

Author: Zarko Todorovski
Date: 2023-05-01T10:39:14-04:00
New Revision: 99fe4d38266ec2527266d996ac95e20c08f498f1

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

LOG: Set EnableAIXExtendedAltivecABI in BackendUtils from LangOpts

Fix a bug where after
github.com/llvm/llvm-project/commit/68dd51421f16f1e17cd453cb1730fcca99a6cfb7
refactor where we are not passing -mabi=vec-extabi to th backend.

Added: 


Modified: 
clang/lib/CodeGen/BackendUtil.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/BackendUtil.cpp 
b/clang/lib/CodeGen/BackendUtil.cpp
index ea38cc402575a..a0cf26006d16f 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -428,7 +428,7 @@ static bool initTargetOptions(DiagnosticsEngine ,
   Options.EmitAddrsig = CodeGenOpts.Addrsig;
   Options.ForceDwarfFrameSection = CodeGenOpts.ForceDwarfFrameSection;
   Options.EmitCallSiteInfo = CodeGenOpts.EmitCallSiteInfo;
-  Options.EnableAIXExtendedAltivecABI = 
CodeGenOpts.EnableAIXExtendedAltivecABI;
+  Options.EnableAIXExtendedAltivecABI = LangOpts.EnableAIXExtendedAltivecABI;
   Options.XRayOmitFunctionIndex = CodeGenOpts.XRayOmitFunctionIndex;
   Options.LoopAlignment = CodeGenOpts.LoopAlignment;
   Options.DebugStrictDwarf = CodeGenOpts.DebugStrictDwarf;



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 951919e - [Clang][AIX] Add back error for -fprofile-sample-generate/use on AIX

2023-04-26 Thread Zarko Todorovski via cfe-commits

Author: Zarko Todorovski
Date: 2023-04-26T14:55:14-04:00
New Revision: 951919e5112cabbd63c7a3bf424736efca81d964

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

LOG: [Clang][AIX] Add back error for -fprofile-sample-generate/use on AIX

D148177 also removed the error for sampling based profiling which is not 
currently
supported on AIX. Adding that error back.

Reviewed By: qiongsiwu1

Differential Revision: https://reviews.llvm.org/D148960

Added: 


Modified: 
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/unsupported-option.c

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index e99fb32289220..9daf1475576a8 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -740,6 +740,12 @@ static void addPGOAndCoverageFlags(const ToolChain , 
Compilation ,
 PGOGenerateArg = nullptr;
   }
 
+  if (TC.getTriple().isOSAIX()) {
+if (Arg *ProfileSampleUseArg = getLastProfileSampleUseArg(Args))
+  D.Diag(diag::err_drv_unsupported_opt_for_target)
+  << ProfileSampleUseArg->getSpelling() << TC.getTriple().str();
+  }
+
   if (ProfileGenerateArg) {
 if (ProfileGenerateArg->getOption().matches(
 options::OPT_fprofile_instr_generate_EQ))

diff  --git a/clang/test/Driver/unsupported-option.c 
b/clang/test/Driver/unsupported-option.c
index 3b7a2b5af2743..3f4227b52b3ba 100644
--- a/clang/test/Driver/unsupported-option.c
+++ b/clang/test/Driver/unsupported-option.c
@@ -13,3 +13,7 @@
 // RUN: not %clang --target=powerpc64-ibm-aix %s -mlong-double-128 2>&1 | \
 // RUN: FileCheck %s --check-prefix=AIX64-LONGDOUBLE128-ERR
 // AIX64-LONGDOUBLE128-ERR: error: unsupported option '-mlong-double-128' for 
target 'powerpc64-ibm-aix'
+
+// RUN: not %clang -fprofile-sample-use=code.prof --target=powerpc-ibm-aix %s 
2>&1 | \
+// RUN: FileCheck %s --check-prefix=AIX-PROFILE-SAMPLE
+// AIX-PROFILE-SAMPLE: error: unsupported option '-fprofile-sample-use=' for 
target



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 8a39465 - [Clang][AIX] Remove error for -fprofile-instr-generate/use on AIX

2023-04-20 Thread Zarko Todorovski via cfe-commits

Author: Zarko Todorovski
Date: 2023-04-20T11:08:12-04:00
New Revision: 8a39465d0015cb6147ea3e96adeb8b560765eea2

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

LOG: [Clang][AIX] Remove error for -fprofile-instr-generate/use on AIX

Instrumented profiling now works on AIX and there is no dependency
on LTO for PGO. Remove the error.

Reviewed By: qiongsiwu1

Differential Revision: https://reviews.llvm.org/D148177

Added: 


Modified: 
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/unsupported-option.c

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index be577239ab04d..7676cbe5e6c0e 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -740,15 +740,6 @@ static void addPGOAndCoverageFlags(const ToolChain , 
Compilation ,
 PGOGenerateArg = nullptr;
   }
 
-  if (TC.getTriple().isOSAIX()) {
-if (ProfileGenerateArg)
-  D.Diag(diag::err_drv_unsupported_opt_for_target)
-  << ProfileGenerateArg->getSpelling() << TC.getTriple().str();
-if (Arg *ProfileSampleUseArg = getLastProfileSampleUseArg(Args))
-  D.Diag(diag::err_drv_unsupported_opt_for_target)
-  << ProfileSampleUseArg->getSpelling() << TC.getTriple().str();
-  }
-
   if (ProfileGenerateArg) {
 if (ProfileGenerateArg->getOption().matches(
 options::OPT_fprofile_instr_generate_EQ))

diff  --git a/clang/test/Driver/unsupported-option.c 
b/clang/test/Driver/unsupported-option.c
index 7594d0fc17eeb..3b7a2b5af2743 100644
--- a/clang/test/Driver/unsupported-option.c
+++ b/clang/test/Driver/unsupported-option.c
@@ -6,14 +6,6 @@
 // RUN: FileCheck %s --check-prefix=DID-YOU-MEAN
 // DID-YOU-MEAN: error: unsupported option '--hell'; did you mean '--help'?
 
-// RUN: not %clang -fprofile-instr-generate --target=powerpc-ibm-aix %s 2>&1 | 
\
-// RUN: FileCheck %s --check-prefix=INVALID-AIX-PROFILE
-// INVALID-AIX-PROFILE: error: unsupported option '-fprofile-instr-generate' 
for target
-
-// RUN: not %clang -fprofile-sample-use=code.prof --target=powerpc-ibm-aix %s 
2>&1 | \
-// RUN: FileCheck %s --check-prefix=AIX-PROFILE-SAMPLE
-// AIX-PROFILE-SAMPLE: error: unsupported option '-fprofile-sample-use=' for 
target
-
 // RUN: not %clang --target=powerpc-ibm-aix %s -mlong-double-128 2>&1 | \
 // RUN: FileCheck %s --check-prefix=AIX-LONGDOUBLE128-ERR
 // AIX-LONGDOUBLE128-ERR: error: unsupported option '-mlong-double-128' for 
target 'powerpc-ibm-aix'



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] a61b202 - [Clang][Sema][AIX][PowerPC] Emit byval alignment warning only when struct is passed to a function

2022-07-13 Thread Zarko Todorovski via cfe-commits

Author: Zarko Todorovski
Date: 2022-07-13T15:32:29-04:00
New Revision: a61b202d4e3b00bf6bfd71dc1ea354d37f73b791

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

LOG: [Clang][Sema][AIX][PowerPC] Emit byval alignment warning only when struct 
is passed to a function

Previous warning went on whenever a struct with a struct member with alignment 
=> 16
was declared. This led to too many false positives and led to diagnostic lit 
failures
due to it being emitted too frequently. Only emit the warning when such a 
struct and
that struct contains a member that has an alignment of 16 bytes is passed to a 
caller
function since this is where the potential binary compatibility issue with XL 
16.1.0
and older exists.

Reviewed By: sfertile, aaron.ballman

Differential Revision: https://reviews.llvm.org/D118350

Added: 


Modified: 
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/include/clang/Sema/Sema.h
clang/lib/Sema/SemaChecking.cpp
clang/lib/Sema/SemaDeclAttr.cpp
clang/test/Analysis/padding_c.c
clang/test/Analysis/padding_cpp.cpp
clang/test/CXX/drs/dr6xx.cpp
clang/test/Sema/aix-attr-align.c
clang/test/SemaTemplate/instantiate-attr.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index ca6390a02ce82..550029f58b546 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -3341,10 +3341,11 @@ def warn_assume_aligned_too_great
   "alignment assumed">,
   InGroup>;
 def warn_not_xl_compatible
-: Warning<"requesting an alignment of 16 bytes or greater for struct"
-  " members is not binary compatible with IBM XL C/C++ for AIX"
-  " 16.1.0 and older">,
+: Warning<"alignment of 16 bytes for a struct member is not binary "
+  "compatible with IBM XL C/C++ for AIX 16.1.0 or older">,
   InGroup;
+def note_misaligned_member_used_here : Note<
+"passing byval argument %0 with potentially incompatible alignment here">;
 def warn_redeclaration_without_attribute_prev_attribute_ignored : Warning<
   "%q0 redeclared without %1 attribute: previous %1 ignored">,
   InGroup;

diff  --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 75a2e7eb31d19..e51b9daef7d3e 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -13039,6 +13039,8 @@ class Sema final {
 ArrayRef Args,
 const FunctionProtoType *Proto, SourceLocation 
Loc);
 
+  void checkAIXMemberAlignment(SourceLocation Loc, const Expr *Arg);
+
   void CheckArgAlignment(SourceLocation Loc, NamedDecl *FDecl,
  StringRef ParamName, QualType ArgTy, QualType 
ParamTy);
 

diff  --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index d3929361213ad..df602f168dbc6 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -5626,6 +5626,40 @@ static void CheckNonNullArguments(Sema ,
   }
 }
 
+// 16 byte ByVal alignment not due to a vector member is not honoured by XL
+// on AIX. Emit a warning here that users are generating binary incompatible
+// code to be safe.
+// Here we try to get information about the alignment of the struct member
+// from the struct passed to the caller function. We only warn when the struct
+// is passed byval, hence the series of checks and early returns if we are a 
not
+// passing a struct byval.
+void Sema::checkAIXMemberAlignment(SourceLocation Loc, const Expr *Arg) {
+  const auto *ICE = dyn_cast(Arg->IgnoreParens());
+  if (!ICE)
+return;
+
+  const auto *DR = dyn_cast(ICE->getSubExpr());
+  if (!DR)
+return;
+
+  const auto *PD = dyn_cast(DR->getDecl());
+  if (!PD || !PD->getType()->isRecordType())
+return;
+
+  QualType ArgType = Arg->getType();
+  for (const FieldDecl *FD :
+   ArgType->castAs()->getDecl()->fields()) {
+if (const auto *AA = FD->getAttr()) {
+  CharUnits Alignment =
+  Context.toCharUnitsFromBits(AA->getAlignment(Context));
+  if (Alignment.getQuantity() == 16) {
+Diag(FD->getLocation(), diag::warn_not_xl_compatible) << FD;
+Diag(Loc, diag::note_misaligned_member_used_here) << PD;
+  }
+}
+  }
+}
+
 /// Warn if a pointer or reference argument passed to a function points to an
 /// object that is less aligned than the parameter. This can happen when
 /// creating a typedef with a lower alignment than the original type and then
@@ -5736,6 +5770,12 @@ void Sema::checkCall(NamedDecl *FDecl, const 
FunctionProtoType *Proto,
 if (Arg->containsErrors())
   continue;
 
+if 

[clang] 3ee685f - [NFC][Clang] Fix some comments in clang

2021-12-01 Thread Zarko Todorovski via cfe-commits

Author: Zarko Todorovski
Date: 2021-12-01T13:36:46-05:00
New Revision: 3ee685f98abfc074419371b372681b56f7fd1a37

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

LOG: [NFC][Clang] Fix some comments in clang

Applying post commit comment suggestions from https://reviews.llvm.org/D114025

Added: 


Modified: 
clang/include/clang/Analysis/CFG.h
clang/lib/Sema/SemaChecking.cpp
clang/lib/Sema/SemaExprCXX.cpp

Removed: 




diff  --git a/clang/include/clang/Analysis/CFG.h 
b/clang/include/clang/Analysis/CFG.h
index 3b9b22e87f35c..b8e453fcc235a 100644
--- a/clang/include/clang/Analysis/CFG.h
+++ b/clang/include/clang/Analysis/CFG.h
@@ -515,7 +515,7 @@ class CFGTerminator {
 /// of the most derived class while we're in the base class.
 VirtualBaseBranch,
 
-/// Number of 
diff erent kinds, for validity checks. We subtract 1 so that
+/// Number of 
diff erent kinds, for assertions. We subtract 1 so that
 /// to keep receiving compiler warnings when we don't cover all enum values
 /// in a switch.
 NumKindsMinusOne = VirtualBaseBranch

diff  --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index ee06425dc654a..33e2b3b5027d4 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -5546,8 +5546,8 @@ ExprResult Sema::BuildAtomicExpr(SourceRange CallRange, 
SourceRange ExprRange,
 
   // For an arithmetic operation, the implied arithmetic must be well-formed.
   if (Form == Arithmetic) {
-// GCC does not enforce these rules for GNU atomics, but we do, because if
-// we didn't it would be very confusing. FIXME:  For whom? How so?
+// GCC does not enforce these rules for GNU atomics, but we do to help 
catch
+// trivial type errors.
 auto IsAllowedValueType = [&](QualType ValType) {
   if (ValType->isIntegerType())
 return true;
@@ -5588,8 +5588,9 @@ ExprResult Sema::BuildAtomicExpr(SourceRange CallRange, 
SourceRange ExprRange,
   if (!IsC11 && !AtomTy.isTriviallyCopyableType(Context) &&
   !AtomTy->isScalarType()) {
 // For GNU atomics, require a trivially-copyable type. This is not part of
-// the GNU atomics specification, but we enforce it, because if we didn't 
it
-// would be very confusing. FIXME:  For whom? How so?
+// the GNU atomics specification but we enforce it for consistency with
+// other atomics which generally all require a trivially-copyable type. 
This
+// is because atomics just copy bits.
 Diag(ExprRange.getBegin(), diag::err_atomic_op_needs_trivial_copy)
 << Ptr->getType() << Ptr->getSourceRange();
 return ExprError();

diff  --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index 6352525845620..d25f329f85e45 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -1508,8 +1508,9 @@ Sema::BuildCXXTypeConstructExpr(TypeSourceInfo *TInfo,
   }
 
   // Only construct objects with object types.
-  // There doesn't seem to be an explicit rule for this but functions are
-  // not objects, so they cannot take initializers.
+  // The standard doesn't explicitly forbid function types here, but that's an
+  // obvious oversight, as there's no way to dynamically construct a function
+  // in general.
   if (Ty->isFunctionType())
 return ExprError(Diag(TyBeginLoc, diag::err_init_for_function_type)
<< Ty << FullRange);



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] f5ad6fa - [clang][docs] Inclusive language: remove use of sanity check in option description

2021-11-30 Thread Zarko Todorovski via cfe-commits

Author: Zarko Todorovski
Date: 2021-11-30T15:07:43-05:00
New Revision: f5ad6fa279cc012427b119828bdb679af5197c70

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

LOG: [clang][docs] Inclusive language: remove use of sanity check in option 
description

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D114562

Added: 


Modified: 
clang/docs/ThreadSafetyAnalysis.rst

Removed: 




diff  --git a/clang/docs/ThreadSafetyAnalysis.rst 
b/clang/docs/ThreadSafetyAnalysis.rst
index 9e18fcdd1b5f3..23f460b248e11 100644
--- a/clang/docs/ThreadSafetyAnalysis.rst
+++ b/clang/docs/ThreadSafetyAnalysis.rst
@@ -466,9 +466,9 @@ Use of these attributes has been deprecated.
 Warning flags
 -
 
-* ``-Wthread-safety``:  Umbrella flag which turns on the following three:
+* ``-Wthread-safety``:  Umbrella flag which turns on the following:
 
-  + ``-Wthread-safety-attributes``: Sanity checks on attribute syntax.
+  + ``-Wthread-safety-attributes``: Semantic checks for thread safety 
attributes.
   + ``-Wthread-safety-analysis``: The core analysis.
   + ``-Wthread-safety-precise``: Requires that mutex expressions match 
precisely.
This warning can be disabled for code which has a lot of aliases.



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] c379911 - [NFC][Clang]Inclusive language: Replace uses of whitelist in clang/test

2021-11-30 Thread Zarko Todorovski via cfe-commits

Author: Zarko Todorovski
Date: 2021-11-30T15:06:04-05:00
New Revision: c379911a94c1e777c232d1e3e65f5c70d0453234

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

LOG: [NFC][Clang]Inclusive language: Replace uses of whitelist in clang/test

Added: 


Modified: 
clang/test/Preprocessor/macro-reserved.c
clang/test/Preprocessor/macro-reserved.cpp
clang/test/Sema/conversion.c
clang/test/SemaCXX/reinterpret-cast.cpp
clang/test/SemaObjC/warn-retain-cycle.m
clang/unittests/Driver/SanitizerArgsTest.cpp

Removed: 




diff  --git a/clang/test/Preprocessor/macro-reserved.c 
b/clang/test/Preprocessor/macro-reserved.c
index f7bec04c73bf8..94245c024edec 100644
--- a/clang/test/Preprocessor/macro-reserved.c
+++ b/clang/test/Preprocessor/macro-reserved.c
@@ -14,7 +14,7 @@
 #undef _HAVE_X
 #undef X__Y
 
-// whitelisted definitions
+// allowlisted definitions
 #define while while
 #define const
 #define static

diff  --git a/clang/test/Preprocessor/macro-reserved.cpp 
b/clang/test/Preprocessor/macro-reserved.cpp
index f06d75cbf1af7..c4f5ee91dd5a6 100644
--- a/clang/test/Preprocessor/macro-reserved.cpp
+++ b/clang/test/Preprocessor/macro-reserved.cpp
@@ -15,7 +15,7 @@
 #undef __cplusplus
 #define __cplusplus
 
-// whitelisted definitions
+// allowlisted definitions
 #define while while
 #define const
 #define static

diff  --git a/clang/test/Sema/conversion.c b/clang/test/Sema/conversion.c
index ba4adbdad22eb..02131e49cb48d 100644
--- a/clang/test/Sema/conversion.c
+++ b/clang/test/Sema/conversion.c
@@ -294,7 +294,7 @@ void test13(long double v) {
 }
 
 void test14(long l) {
-  // Fine because of the boolean whitelist.
+  // Fine because of the boolean allowlist.
   char c;
   c = (l == 4);
   c = ((l <= 4) && (l >= 0));

diff  --git a/clang/test/SemaCXX/reinterpret-cast.cpp 
b/clang/test/SemaCXX/reinterpret-cast.cpp
index f427af1efbafc..1b84df12129c7 100644
--- a/clang/test/SemaCXX/reinterpret-cast.cpp
+++ b/clang/test/SemaCXX/reinterpret-cast.cpp
@@ -221,7 +221,7 @@ void dereference_reinterpret_cast() {
   (void)*reinterpret_cast(); // expected-warning {{ISO C++ does not 
allow}}
 }
 
-void reinterpret_cast_whitelist () {
+void reinterpret_cast_allowlist () {
   // the dynamic type of the object
   int a;
   float b;

diff  --git a/clang/test/SemaObjC/warn-retain-cycle.m 
b/clang/test/SemaObjC/warn-retain-cycle.m
index 7d40e26f594ef..eadd227f86d1f 100644
--- a/clang/test/SemaObjC/warn-retain-cycle.m
+++ b/clang/test/SemaObjC/warn-retain-cycle.m
@@ -111,7 +111,7 @@ @interface Test3 {
 void doSomething(unsigned v);
 @implementation Test3
 - (void) test {
-  // 'addOperationWithBlock:' is specifically whitelisted.
+  // 'addOperationWithBlock:' is specifically allowlisted.
   [myOperationQueue addOperationWithBlock:^() { // no-warning
 if (count > 20) {
   doSomething(count);

diff  --git a/clang/unittests/Driver/SanitizerArgsTest.cpp 
b/clang/unittests/Driver/SanitizerArgsTest.cpp
index 2539330126f06..8eecd53ef40c2 100644
--- a/clang/unittests/Driver/SanitizerArgsTest.cpp
+++ b/clang/unittests/Driver/SanitizerArgsTest.cpp
@@ -114,7 +114,7 @@ TEST_F(SanitizerArgsTest, Ignorelists) {
 }
 
 TEST_F(SanitizerArgsTest, XRayLists) {
-  const std::string XRayWhitelist = "/source/xray_whitelist.txt";
+  const std::string XRayAllowlist = "/source/xray_allowlist.txt";
   const std::string XRayIgnorelist = "/source/xray_ignorelist.txt";
   const std::string XRayAttrList = "/source/xray_attr_list.txt";
 
@@ -122,16 +122,16 @@ TEST_F(SanitizerArgsTest, XRayLists) {
   /*ExtraArgs=*/
   {
   "-fxray-instrument",
-  "-fxray-always-instrument=" + XRayWhitelist,
+  "-fxray-always-instrument=" + XRayAllowlist,
   "-fxray-never-instrument=" + XRayIgnorelist,
   "-fxray-attr-list=" + XRayAttrList,
   },
-  /*ExtraFiles=*/{XRayWhitelist, XRayIgnorelist, XRayAttrList});
+  /*ExtraFiles=*/{XRayAllowlist, XRayIgnorelist, XRayAttrList});
 
   // Ignorelists exist in the filesystem, so they should be added to the
   // compilation command, produced by the driver.
   EXPECT_THAT(Command.getArguments(),
-  Contains(StrEq("-fxray-always-instrument=" + XRayWhitelist)));
+  Contains(StrEq("-fxray-always-instrument=" + XRayAllowlist)));
   EXPECT_THAT(Command.getArguments(),
   Contains(StrEq("-fxray-never-instrument=" + XRayIgnorelist)));
   EXPECT_THAT(Command.getArguments(),



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 5162b55 - [clang][NFC] Inclusive terms: rename AccessDeclContextSanity to AccessDeclContextCheck

2021-11-25 Thread Zarko Todorovski via cfe-commits

Author: Zarko Todorovski
Date: 2021-11-25T16:21:06-05:00
New Revision: 5162b558d8c0b542e752b037e72a69d5fd51eb1e

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

LOG: [clang][NFC] Inclusive terms: rename AccessDeclContextSanity to 
AccessDeclContextCheck

Rename function to more inclusive name.

Reviewed By: quinnp

Differential Revision: https://reviews.llvm.org/D114029

Added: 


Modified: 
clang/include/clang/AST/DeclBase.h
clang/lib/AST/DeclBase.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp

Removed: 




diff  --git a/clang/include/clang/AST/DeclBase.h 
b/clang/include/clang/AST/DeclBase.h
index 18468c8ca1c47..2a0a19597391f 100644
--- a/clang/include/clang/AST/DeclBase.h
+++ b/clang/include/clang/AST/DeclBase.h
@@ -352,7 +352,7 @@ class alignas(8) Decl {
  DeclContext *Parent, std::size_t Extra = 0);
 
 private:
-  bool AccessDeclContextSanity() const;
+  bool AccessDeclContextCheck() const;
 
   /// Get the module ownership kind to use for a local lexical child of \p DC,
   /// which may be either a local or (rarely) an imported declaration.
@@ -472,11 +472,11 @@ class alignas(8) Decl {
 
   void setAccess(AccessSpecifier AS) {
 Access = AS;
-assert(AccessDeclContextSanity());
+assert(AccessDeclContextCheck());
   }
 
   AccessSpecifier getAccess() const {
-assert(AccessDeclContextSanity());
+assert(AccessDeclContextCheck());
 return AccessSpecifier(Access);
   }
 

diff  --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp
index 4044404f74ef2..d8eaf706384f5 100644
--- a/clang/lib/AST/DeclBase.cpp
+++ b/clang/lib/AST/DeclBase.cpp
@@ -964,7 +964,7 @@ SourceLocation Decl::getBodyRBrace() const {
   return {};
 }
 
-bool Decl::AccessDeclContextSanity() const {
+bool Decl::AccessDeclContextCheck() const {
 #ifndef NDEBUG
   // Suppress this check if any of the following hold:
   // 1. this is the translation unit (and thus has no parent)

diff  --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index b20ae32a08ac7..b1dbc382ff041 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -91,7 +91,7 @@ static void VerifyDecl(clang::Decl *decl) {
   assert(decl && "VerifyDecl called with nullptr?");
 #ifndef NDEBUG
   // We don't care about the actual access value here but only want to trigger
-  // that Clang calls its internal Decl::AccessDeclContextSanity check.
+  // that Clang calls its internal Decl::AccessDeclContextCheck validation.
   decl->getAccess();
 #endif
 }



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] d42a643 - [NFC][clang]Inclusive language: remove remaining uses of sanity

2021-11-24 Thread Zarko Todorovski via cfe-commits

Author: Zarko Todorovski
Date: 2021-11-24T14:20:13-05:00
New Revision: d42a6432aa37a6b9aa7e4f5209e9679c8a4c2fbb

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

LOG: [NFC][clang]Inclusive language: remove remaining uses of sanity

Missed some uses of sanity check in previous commits.

Added: 


Modified: 
clang/lib/AST/ExprConstant.cpp
clang/lib/StaticAnalyzer/Core/CoreEngine.cpp
clang/utils/TableGen/ASTTableGen.cpp
clang/utils/check_cfc/check_cfc.py

Removed: 




diff  --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index fe96db9ca918e..99babd58b0276 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -7483,7 +7483,7 @@ class ExprEvaluatorBase
 const Expr *Source = E->getSourceExpr();
 if (!Source)
   return Error(E);
-if (Source == E) { // sanity checking.
+if (Source == E) {
   assert(0 && "OpaqueValueExpr recursively refers to itself");
   return Error(E);
 }

diff  --git a/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp 
b/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp
index bc939d2528002..d57bab154b617 100644
--- a/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp
+++ b/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp
@@ -686,8 +686,8 @@ SwitchNodeBuilder::generateDefaultCaseNode(ProgramStateRef 
St,
   assert(Src->succ_rbegin() != Src->succ_rend());
   CFGBlock *DefaultBlock = *Src->succ_rbegin();
 
-  // Sanity check for default blocks that are unreachable and not caught
-  // by earlier stages.
+  // Basic correctness check for default blocks that are unreachable and not
+  // caught by earlier stages.
   if (!DefaultBlock)
 return nullptr;
 

diff  --git a/clang/utils/TableGen/ASTTableGen.cpp 
b/clang/utils/TableGen/ASTTableGen.cpp
index 3f6da40964e0b..6aa8b28a942f3 100644
--- a/clang/utils/TableGen/ASTTableGen.cpp
+++ b/clang/utils/TableGen/ASTTableGen.cpp
@@ -107,7 +107,7 @@ static void visitASTNodeRecursive(ASTNode node, ASTNode 
base,
 static void visitHierarchy(RecordKeeper ,
StringRef nodeClassName,
ASTNodeHierarchyVisitor visit) {
-  // Check for the node class, just as a sanity check.
+  // Check for the node class, just as a basic correctness check.
   if (!records.getClass(nodeClassName)) {
 PrintFatalError(Twine("cannot find definition for node class ")
   + nodeClassName);

diff  --git a/clang/utils/check_cfc/check_cfc.py 
b/clang/utils/check_cfc/check_cfc.py
index 311f502f800b3..cab33b41c1ca0 100755
--- a/clang/utils/check_cfc/check_cfc.py
+++ b/clang/utils/check_cfc/check_cfc.py
@@ -339,7 +339,7 @@ def perform_check(self, arguments, my_env):
 # Prevent infinite loop if called with absolute path.
 arguments_a[0] = os.path.basename(arguments_a[0])
 
-# Sanity check
+# Basic correctness check
 enabled_checks = [check_name
   for check_name in checks
   if config.getboolean('Checks', check_name)]



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] c79345f - [NFC][Clang][test] Inclusive language: Remove and rephrase uses of sanity test/check in clang/test

2021-11-24 Thread Zarko Todorovski via cfe-commits

Author: Zarko Todorovski
Date: 2021-11-24T14:03:49-05:00
New Revision: c79345fb7b149d9c952f8506c9e6c6317a5b4cd8

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

LOG: [NFC][Clang][test] Inclusive language: Remove and rephrase uses of sanity 
test/check in clang/test

Part of work to use more inclusive terms in clang/llvm.

Added: 


Modified: 
clang/test/Analysis/additive-folding.cpp
clang/test/Analysis/bitwise-ops.c
clang/test/Analysis/comparison-implicit-casts.cpp
clang/test/Analysis/ctor.mm
clang/test/Analysis/derived-to-base.cpp
clang/test/Analysis/dtor.cpp
clang/test/Analysis/expr-inspection.cpp
clang/test/Analysis/malloc-sizeof.cpp
clang/test/Analysis/plist-html-macros.c
clang/test/Analysis/reference.cpp
clang/test/Analysis/retain-release.m
clang/test/CodeGen/attr-nodebug.c
clang/test/CodeGenObjCXX/arc-attrs.mm
clang/test/CodeGenObjCXX/arc.mm
clang/test/Driver/arm-target-as-march-mcpu.s
clang/test/Driver/clang-g-opts.c
clang/test/Modules/framework-name.m
clang/test/Modules/target-features.m
clang/test/Modules/va_list.m
clang/test/PCH/cxx11-statement-attributes.cpp
clang/test/Rewriter/instancetype-test.mm
clang/test/Rewriter/rewrite-foreach-in-block.mm
clang/test/Sema/dllexport.c
clang/test/Sema/dllimport.c
clang/test/Sema/predef.c
clang/test/SemaCXX/coroutines-exp-namespace.cpp
clang/test/SemaCXX/coroutines.cpp
clang/test/SemaCXX/dllexport.cpp
clang/test/SemaCXX/dllimport.cpp
clang/test/SemaCXX/warn-thread-safety-analysis.cpp
clang/test/SemaObjC/arc-repeated-weak.mm
clang/test/SemaObjC/conversion.m
clang/test/SemaObjC/instancetype.m
clang/test/SemaObjC/warn-retain-cycle.m
clang/test/SemaObjCXX/instancetype.mm
clang/unittests/AST/ASTImporterFixtures.h
clang/unittests/Analysis/CFGDominatorTree.cpp
clang/unittests/Sema/ExternalSemaSourceTest.cpp
clang/unittests/Tooling/Syntax/TokensTest.cpp

Removed: 




diff  --git a/clang/test/Analysis/additive-folding.cpp 
b/clang/test/Analysis/additive-folding.cpp
index 6c84bf345e5ee..ddb32bdfa966a 100644
--- a/clang/test/Analysis/additive-folding.cpp
+++ b/clang/test/Analysis/additive-folding.cpp
@@ -141,7 +141,7 @@ void tautologiesOutside(unsigned char a) {
 
 // Wraparound with mixed types. Note that the analyzer assumes
 // -fwrapv semantics.
-void mixedWraparoundSanityCheck(int a) {
+void mixedWraparoundBasicCheck(int a) {
   int max = INT_MAX;
   int min = INT_MIN;
 
@@ -197,7 +197,7 @@ void mixedSignedness3(unsigned a) {
 }
 
 
-void multiplicativeSanityTest(int x) {
+void multiplicativeBasicTest(int x) {
   // At one point we were ignoring the *4 completely -- the constraint manager
   // would see x < 8 and then declare the assertion to be known false.
   if (x*4 < 8)

diff  --git a/clang/test/Analysis/bitwise-ops.c 
b/clang/test/Analysis/bitwise-ops.c
index fcd3d7dbc7cff..d8d2c920517d4 100644
--- a/clang/test/Analysis/bitwise-ops.c
+++ b/clang/test/Analysis/bitwise-ops.c
@@ -4,7 +4,7 @@ void clang_analyzer_eval(int);
 #define CHECK(expr) if (!(expr)) return; clang_analyzer_eval(expr)
 
 void testPersistentConstraints(int x, int y) {
-  // Sanity check
+  // Basic check
   CHECK(x); // expected-warning{{TRUE}}
   CHECK(x & 1); // expected-warning{{TRUE}}
   

diff  --git a/clang/test/Analysis/comparison-implicit-casts.cpp 
b/clang/test/Analysis/comparison-implicit-casts.cpp
index fe5254c0a53bd..dac2860110366 100644
--- a/clang/test/Analysis/comparison-implicit-casts.cpp
+++ b/clang/test/Analysis/comparison-implicit-casts.cpp
@@ -18,7 +18,7 @@ typedef typeof(sizeof(int)) size_t;
 void PR12206(int x) {
   size_t comparisonSize = sizeof(1 == 1);
 
-  // Sanity check. This test is useless if size_t isn't bigger than bool.
+  // This test is useless if size_t isn't bigger than bool.
   clang_analyzer_eval(sizeof(size_t) > comparisonSize); // 
expected-warning{{TRUE}}
 
   // Build a SymIntExpr, dependent on x.
@@ -75,7 +75,7 @@ size_t strlen(const char *s);
 void PR12206_strlen(const char *x) {
   size_t comparisonSize = sizeof(1 == 1);
 
-  // Sanity check. This test is useless if size_t isn't bigger than bool.
+  // This test is useless if size_t isn't bigger than bool.
   clang_analyzer_eval(sizeof(size_t) > comparisonSize); // 
expected-warning{{TRUE}}
 
   // Create a value that requires more bits to store than a comparison result.

diff  --git a/clang/test/Analysis/ctor.mm b/clang/test/Analysis/ctor.mm
index 08f06e75aebfe..1eafabb443de6 100644
--- a/clang/test/Analysis/ctor.mm
+++ b/clang/test/Analysis/ctor.mm
@@ -93,7 +93,7 @@ void test() {
 
 clang_analyzer_eval(obj.get() == 3); // expected-warning{{TRUE}}
 
-// Sanity check for devirtualization.
+// Correctness 

[clang] d8e5a0c - [clang][NFC] Inclusive terms: replace some uses of sanity in clang

2021-11-19 Thread Zarko Todorovski via cfe-commits

Author: Zarko Todorovski
Date: 2021-11-19T14:58:35-05:00
New Revision: d8e5a0c42bd8796cce9caa53aacab88c7cb2a3eb

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

LOG: [clang][NFC] Inclusive terms: replace some uses of sanity in clang

Rewording of comments to avoid using `sanity test, sanity check`.

Reviewed By: aaron.ballman, Quuxplusone

Differential Revision: https://reviews.llvm.org/D114025

Added: 


Modified: 
clang/include/clang/AST/Redeclarable.h
clang/include/clang/Analysis/CFG.h
clang/include/clang/CodeGen/CGFunctionInfo.h
clang/include/clang/Sema/Lookup.h
clang/lib/Analysis/BodyFarm.cpp
clang/lib/Analysis/RetainSummaryManager.cpp
clang/lib/Basic/DiagnosticIDs.cpp
clang/lib/Basic/SourceManager.cpp
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Format/Format.cpp
clang/lib/Frontend/FrontendActions.cpp
clang/lib/Sema/SemaChecking.cpp
clang/lib/Sema/SemaDecl.cpp
clang/lib/Sema/SemaDeclCXX.cpp
clang/lib/Sema/SemaExpr.cpp
clang/lib/Sema/SemaExprCXX.cpp
clang/lib/Sema/SemaLookup.cpp
clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
clang/lib/StaticAnalyzer/Checkers/MIGChecker.cpp
clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
clang/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp
clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
clang/lib/StaticAnalyzer/Core/Store.cpp
clang/lib/Tooling/Syntax/Tree.cpp

Removed: 




diff  --git a/clang/include/clang/AST/Redeclarable.h 
b/clang/include/clang/AST/Redeclarable.h
index 77b827c52bfb3..58ec07973920c 100644
--- a/clang/include/clang/AST/Redeclarable.h
+++ b/clang/include/clang/AST/Redeclarable.h
@@ -258,7 +258,8 @@ class Redeclarable {
 
 redecl_iterator& operator++() {
   assert(Current && "Advancing while iterator has reached end");
-  // Sanity check to avoid infinite loop on invalid redecl chain.
+  // Make sure we don't infinitely loop on an invalid redecl chain. This
+  // should never happen.
   if (Current->isFirstDecl()) {
 if (PassedFirst) {
   assert(0 && "Passed first decl twice, invalid redecl chain!");

diff  --git a/clang/include/clang/Analysis/CFG.h 
b/clang/include/clang/Analysis/CFG.h
index f9223fe58a27a..3b9b22e87f35c 100644
--- a/clang/include/clang/Analysis/CFG.h
+++ b/clang/include/clang/Analysis/CFG.h
@@ -515,7 +515,7 @@ class CFGTerminator {
 /// of the most derived class while we're in the base class.
 VirtualBaseBranch,
 
-/// Number of 
diff erent kinds, for sanity checks. We subtract 1 so that
+/// Number of 
diff erent kinds, for validity checks. We subtract 1 so that
 /// to keep receiving compiler warnings when we don't cover all enum values
 /// in a switch.
 NumKindsMinusOne = VirtualBaseBranch

diff  --git a/clang/include/clang/CodeGen/CGFunctionInfo.h 
b/clang/include/clang/CodeGen/CGFunctionInfo.h
index 4899c9deda6a3..cd6c7e2e31287 100644
--- a/clang/include/clang/CodeGen/CGFunctionInfo.h
+++ b/clang/include/clang/CodeGen/CGFunctionInfo.h
@@ -250,7 +250,7 @@ class ABIArgInfo {
   static ABIArgInfo getCoerceAndExpand(llvm::StructType *coerceToType,
llvm::Type *unpaddedCoerceToType) {
 #ifndef NDEBUG
-// Sanity checks on unpaddedCoerceToType.
+// Check that unpaddedCoerceToType has roughly the right shape.
 
 // Assert that we only have a struct type if there are multiple elements.
 auto unpaddedStruct = dyn_cast(unpaddedCoerceToType);

diff  --git a/clang/include/clang/Sema/Lookup.h 
b/clang/include/clang/Sema/Lookup.h
index c6edc2df5b9f6..54fe7081b7105 100644
--- a/clang/include/clang/Sema/Lookup.h
+++ b/clang/include/clang/Sema/Lookup.h
@@ -319,7 +319,7 @@ class LookupResult {
   }
 
   LookupResultKind getResultKind() const {
-assert(sanity());
+assert(checkDebugAssumptions());
 return ResultKind;
   }
 
@@ -706,10 +706,9 @@ class LookupResult {
   void addDeclsFromBasePaths(const CXXBasePaths );
   void configure();
 
-  // Sanity checks.
-  bool sanity() const;
+  bool checkDebugAssumptions() const;
 
-  bool sanityCheckUnresolved() const {
+  bool checkUnresolved() const {
 for (iterator I = begin(), E = end(); I != E; ++I)
   if (isa((*I)->getUnderlyingDecl()))
 return true;

diff  --git a/clang/lib/Analysis/BodyFarm.cpp b/clang/lib/Analysis/BodyFarm.cpp
index 49ac74c233bd6..92c236ed9080c 100644
--- a/clang/lib/Analysis/BodyFarm.cpp
+++ b/clang/lib/Analysis/BodyFarm.cpp
@@ -790,9 +790,8 @@ static Stmt *createObjCPropertyGetter(ASTContext ,
 }
   }
 
-  // Sanity check that the property is the same type as the ivar, or a
-  // reference to it, and that it is either an object 

[clang] 8924ba3 - [NFC][clang] Inclusive terms: replace uses of blacklist in clang/test/

2021-11-17 Thread Zarko Todorovski via cfe-commits

Author: Zarko Todorovski
Date: 2021-11-17T09:43:02-05:00
New Revision: 8924ba3bf8c6b0e8d14dff455e4e449a426a2700

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

LOG: [NFC][clang] Inclusive terms: replace uses of blacklist in clang/test/

Replace filenames, variable names, check prefixes uses of blacklist with ignore 
list.

Reviewed By: jkorous

Differential Revision: https://reviews.llvm.org/D113211

Added: 
clang/test/CodeGen/Inputs/sanitizer-ignorelist-vfsoverlay.yaml
clang/test/CodeGen/catch-alignment-assumption-ignorelist.c
clang/test/CodeGen/catch-nullptr-and-nonzero-offset-ignorelist.c
clang/test/CodeGen/ubsan-ignorelist.c
clang/test/CodeGenCXX/cfi-ignorelist.cpp

Modified: 
clang/test/CodeGen/address-safety-attr.cpp
clang/test/CodeGen/asan-globals.cpp
clang/test/CodeGen/catch-implicit-integer-sign-changes-true-negatives.c
clang/test/CodeGen/catch-implicit-integer-truncations-basics-negatives.c
clang/test/CodeGen/catch-implicit-integer-truncations.c

clang/test/CodeGen/catch-implicit-signed-integer-truncations-basics-negatives.c

clang/test/CodeGen/catch-implicit-unsigned-integer-truncations-basics-negatives.c
clang/test/CodeGen/cfi-check-fail2.c
clang/test/CodeGen/sanitize-thread-attr.cpp
clang/test/CodeGen/ubsan-ignorelist-vfs.c
clang/test/CodeGenCXX/catch-implicit-integer-sign-changes-true-negatives.cpp

Removed: 
clang/test/CodeGen/Inputs/sanitizer-blacklist-vfsoverlay.yaml
clang/test/CodeGen/catch-alignment-assumption-blacklist.c
clang/test/CodeGen/catch-nullptr-and-nonzero-offset-blacklist.c
clang/test/CodeGen/ubsan-blacklist.c
clang/test/CodeGenCXX/cfi-blacklist.cpp



diff  --git a/clang/test/CodeGen/Inputs/sanitizer-blacklist-vfsoverlay.yaml 
b/clang/test/CodeGen/Inputs/sanitizer-ignorelist-vfsoverlay.yaml
similarity index 63%
rename from clang/test/CodeGen/Inputs/sanitizer-blacklist-vfsoverlay.yaml
rename to clang/test/CodeGen/Inputs/sanitizer-ignorelist-vfsoverlay.yaml
index df2b221897693..7fb4069034351 100644
--- a/clang/test/CodeGen/Inputs/sanitizer-blacklist-vfsoverlay.yaml
+++ b/clang/test/CodeGen/Inputs/sanitizer-ignorelist-vfsoverlay.yaml
@@ -3,10 +3,10 @@
   'roots': [
 { 'name': '@DIR@', 'type': 'directory',
   'contents': [
-{ 'name': 'only-virtual-file.blacklist', 'type': 'file',
+{ 'name': 'only-virtual-file.ignorelist', 'type': 'file',
   'external-contents': '@REAL_FILE@'
 },
-{ 'name': 'invalid-virtual-file.blacklist', 'type': 'file',
+{ 'name': 'invalid-virtual-file.ignorelist', 'type': 'file',
   'external-contents': '@NONEXISTENT_FILE@'
 }
   ]

diff  --git a/clang/test/CodeGen/address-safety-attr.cpp 
b/clang/test/CodeGen/address-safety-attr.cpp
index 742263ae353dc..bd899ed2f9a74 100644
--- a/clang/test/CodeGen/address-safety-attr.cpp
+++ b/clang/test/CodeGen/address-safety-attr.cpp
@@ -6,13 +6,13 @@ int DefinedInDifferentFile(int *a);
 // RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-darwin -disable-O0-optnone 
-emit-llvm -o - %s -include %t.extra-source.cpp | FileCheck 
-check-prefix=WITHOUT %s
 // RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-darwin -disable-O0-optnone 
-emit-llvm -o - %s -include %t.extra-source.cpp -fsanitize=address | FileCheck 
-check-prefix=ASAN %s
 
-// RUN: echo "fun:*BlacklistedFunction*" > %t.func.blacklist
-// RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-darwin -disable-O0-optnone 
-emit-llvm -o - %s -include %t.extra-source.cpp -fsanitize=address 
-fsanitize-blacklist=%t.func.blacklist | FileCheck -check-prefix=BLFUNC %s
+// RUN: echo "fun:*IgnorelistedFunction*" > %t.func.ignorelist
+// RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-darwin -disable-O0-optnone 
-emit-llvm -o - %s -include %t.extra-source.cpp -fsanitize=address 
-fsanitize-ignorelist=%t.func.ignorelist | FileCheck -check-prefix=BLFUNC %s
 
-// The blacklist file uses regexps, so escape backslashes, which are common in
+// The ignorelist file uses regexps, so escape backslashes, which are common in
 // Windows paths.
-// RUN: echo "src:%s" | sed -e 's/\\//g' > %t.file.blacklist
-// RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-darwin -disable-O0-optnone 
-emit-llvm -o - %s -include %t.extra-source.cpp -fsanitize=address 
-fsanitize-blacklist=%t.file.blacklist | FileCheck -check-prefix=BLFILE %s
+// RUN: echo "src:%s" | sed -e 's/\\//g' > %t.file.ignorelist
+// RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-darwin -disable-O0-optnone 
-emit-llvm -o - %s -include %t.extra-source.cpp -fsanitize=address 
-fsanitize-ignorelist=%t.file.ignorelist | FileCheck -check-prefix=BLFILE %s
 
 // The sanitize_address attribute should be attached to functions
 // when AddressSanitizer is enabled, 

[clang] 05f34ff - [clang] Inclusive language: change instances of blacklist/whitelist to allowlist/ignorelist

2021-11-12 Thread Zarko Todorovski via cfe-commits

Author: Zarko Todorovski
Date: 2021-11-12T15:46:16Z
New Revision: 05f34ffa216975f132fa1bd4cbf8424053a19147

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

LOG: [clang] Inclusive language: change instances of blacklist/whitelist to 
allowlist/ignorelist

Change the error message to use ignorelist, and changed some variable and 
function
names in related code and test.

Reviewed By: thakis

Differential Revision: https://reviews.llvm.org/D113189

Added: 


Modified: 
clang/include/clang/AST/CommentHTMLTags.td
clang/include/clang/Basic/DiagnosticASTKinds.td
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Frontend/HeaderIncludeGen.cpp
clang/test/CodeGen/sanitize-address-field-padding.cpp

Removed: 




diff  --git a/clang/include/clang/AST/CommentHTMLTags.td 
b/clang/include/clang/AST/CommentHTMLTags.td
index 251490094940..a1ce8c6da96c 100644
--- a/clang/include/clang/AST/CommentHTMLTags.td
+++ b/clang/include/clang/AST/CommentHTMLTags.td
@@ -52,11 +52,11 @@ def Tr  : Tag<"tr"> { let EndTagOptional = 1; }
 def Th  : Tag<"th"> { let EndTagOptional = 1; }
 def Td  : Tag<"td"> { let EndTagOptional = 1; }
 
-// Define a blacklist of attributes that are not safe to pass through to HTML
+// Define a list of attributes that are not safe to pass through to HTML
 // output if the input is untrusted.
 //
-// FIXME: this should be a whitelist.  When changing this to a whitelist, don't
-// forget to change the default in the TableGen backend.
+// FIXME: This should be a list of attributes that _are_ safe.  When changing
+// this change, don't forget to change the default in the TableGen backend.
 class Attribute {
   string Spelling = spelling;
   bit IsSafeToPassThrough = 1;

diff  --git a/clang/include/clang/Basic/DiagnosticASTKinds.td 
b/clang/include/clang/Basic/DiagnosticASTKinds.td
index 496d86ee2fe7..d788c8517914 100644
--- a/clang/include/clang/Basic/DiagnosticASTKinds.td
+++ b/clang/include/clang/Basic/DiagnosticASTKinds.td
@@ -567,8 +567,8 @@ def remark_sanitize_address_insert_extra_padding_accepted : 
Remark<
 def remark_sanitize_address_insert_extra_padding_rejected : Remark<
 "-fsanitize-address-field-padding ignored for %0 because it "
 "%select{is not C++|is packed|is a union|is trivially copyable|"
-"has trivial destructor|is standard layout|is in a blacklisted file|"
-"is blacklisted}1">, ShowInSystemHeader,
+"has trivial destructor|is standard layout|is in a ignorelisted file|"
+"is ignorelisted}1">, ShowInSystemHeader,
 InGroup;
 
 def warn_npot_ms_struct : Warning<

diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index a3023f1c95e5..6e1891aa85de 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -4621,7 +4621,7 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
 
 // reject options that shouldn't be supported in bitcode
 // also reject kernel/kext
-static const constexpr unsigned kBitcodeOptionBlacklist[] = {
+static const constexpr unsigned kBitcodeOptionIgnorelist[] = {
 options::OPT_mkernel,
 options::OPT_fapple_kext,
 options::OPT_ffunction_sections,
@@ -4665,7 +4665,7 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
 options::OPT_mllvm,
 };
 for (const auto  : Args)
-  if (llvm::is_contained(kBitcodeOptionBlacklist, A->getOption().getID()))
+  if (llvm::is_contained(kBitcodeOptionIgnorelist, A->getOption().getID()))
 D.Diag(diag::err_drv_unsupported_embed_bitcode) << A->getSpelling();
 
 // Render the CodeGen options that need to be passed.

diff  --git a/clang/lib/Frontend/HeaderIncludeGen.cpp 
b/clang/lib/Frontend/HeaderIncludeGen.cpp
index 1ee47d8d2480..5db8792bf420 100644
--- a/clang/lib/Frontend/HeaderIncludeGen.cpp
+++ b/clang/lib/Frontend/HeaderIncludeGen.cpp
@@ -119,7 +119,7 @@ void clang::AttachHeaderIncludeGen(Preprocessor ,
   // Print header info for extra headers, pretending they were discovered by
   // the regular preprocessor. The primary use case is to support proper
   // generation of Make / Ninja file dependencies for implicit includes, such
-  // as sanitizer blacklists. It's only important for cl.exe compatibility,
+  // as sanitizer ignorelists. It's only important for cl.exe compatibility,
   // the GNU way to generate rules is -M / -MM / -MD / -MMD.
   for (const auto  : DepOpts.ExtraDeps)
 PrintHeaderInfo(OutputFile, Header.first, ShowDepth, 2, MSStyle);

diff  --git a/clang/test/CodeGen/sanitize-address-field-padding.cpp 
b/clang/test/CodeGen/sanitize-address-field-padding.cpp
index fbbabe96be9b..67316bd97412 100644
--- a/clang/test/CodeGen/sanitize-address-field-padding.cpp
+++ 

[clang] 1b75285 - [AIX][Clang] Fix XL product name in AIX XL compatibility warning

2021-11-05 Thread Zarko Todorovski via cfe-commits

Author: Zarko Todorovski
Date: 2021-11-05T13:17:30-04:00
New Revision: 1b7528554f835d58036543de1e8839ba1ac29f1f

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

LOG: [AIX][Clang] Fix XL product name in AIX XL compatibility warning

Correct the XLC/C++ version in the warning message to use the information from
XL's -qversion output.

Reviewed By: rzurob

Differential Revision: https://reviews.llvm.org/D112847

Added: 


Modified: 
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/test/Sema/aix-attr-align.c

Removed: 




diff  --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index 1daea69e791c9..3f887309825a5 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -3277,7 +3277,8 @@ def warn_assume_aligned_too_great
   InGroup>;
 def warn_not_xl_compatible
 : Warning<"requesting an alignment of 16 bytes or greater for struct"
-  " members is not binary compatible with AIX XL 16.1 and older">,
+  " members is not binary compatible with IBM XL C/C++ for AIX"
+  " 16.1.0 and older">,
   InGroup;
 def warn_redeclaration_without_attribute_prev_attribute_ignored : Warning<
   "%q0 redeclared without %1 attribute: previous %1 ignored">,

diff  --git a/clang/test/Sema/aix-attr-align.c 
b/clang/test/Sema/aix-attr-align.c
index ac70aab669004..0fd6af4ee4c13 100644
--- a/clang/test/Sema/aix-attr-align.c
+++ b/clang/test/Sema/aix-attr-align.c
@@ -10,11 +10,11 @@ struct S {
 };
 
 struct T {
-  int a[4] __attribute__((aligned(16))); // expected-warning {{requesting an 
alignment of 16 bytes or greater for struct members is not binary compatible 
with AIX XL 16.1 and older}}
+  int a[4] __attribute__((aligned(16))); // expected-warning {{requesting an 
alignment of 16 bytes or greater for struct members is not binary compatible 
with IBM XL C/C++ for AIX 16.1.0 and older}}
 };
 
 struct U {
-  int a[2] __attribute__((aligned(32))); // expected-warning {{requesting an 
alignment of 16 bytes or greater for struct members is not binary compatible 
with AIX XL 16.1 and older}}
+  int a[2] __attribute__((aligned(32))); // expected-warning {{requesting an 
alignment of 16 bytes or greater for struct members is not binary compatible 
with IBM XL C/C++ for AIX 16.1.0 and older}}
 };
 
 int a[8] __attribute__((aligned(8)));  // no-warning



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] a83a6c2 - [clang] [Objective C] Inclusive language: use objcmt-allowlist-dir-path= instead of objcmt-white-list-dir-path=

2021-11-05 Thread Zarko Todorovski via cfe-commits

Author: Zarko Todorovski
Date: 2021-11-05T12:27:05-04:00
New Revision: a83a6c22e63ad84e9c210c71b36413bed72ac23c

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

LOG: [clang] [Objective C] Inclusive language: use 
objcmt-allowlist-dir-path= instead of objcmt-white-list-dir-path=

Trying to update some options that don't at least have an inclusive language 
version.
This patch adds `objcmt-allowlist-dir-path` as a default alternative.

Reviewed By: akyrtzi

Differential Revision: https://reviews.llvm.org/D112591

Added: 
clang/test/ARCMT/allowlisted/Inputs/header1.h
clang/test/ARCMT/allowlisted/header1.h
clang/test/ARCMT/allowlisted/header1.h.result
clang/test/ARCMT/allowlisted/header2.h
clang/test/ARCMT/allowlisted/header2.h.result
clang/test/ARCMT/allowlisted/objcmt-with-allowlist-impl.m
clang/test/ARCMT/allowlisted/objcmt-with-allowlist-impl.m.result
clang/test/ARCMT/allowlisted/objcmt-with-allowlist.m

Modified: 
clang/docs/ClangCommandLineReference.rst
clang/include/clang/Driver/Options.td
clang/include/clang/Frontend/FrontendOptions.h
clang/lib/ARCMigrate/ObjCMT.cpp
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/SemaObjC/method-conflict-1.m
clang/test/SemaObjC/method-conflict-2.m
clang/test/SemaObjC/method-typecheck-3.m

Removed: 
clang/test/ARCMT/whitelisted/Inputs/header1.h
clang/test/ARCMT/whitelisted/header1.h
clang/test/ARCMT/whitelisted/header1.h.result
clang/test/ARCMT/whitelisted/header2.h
clang/test/ARCMT/whitelisted/header2.h.result
clang/test/ARCMT/whitelisted/objcmt-with-whitelist-impl.m
clang/test/ARCMT/whitelisted/objcmt-with-whitelist-impl.m.result
clang/test/ARCMT/whitelisted/objcmt-with-whitelist.m



diff  --git a/clang/docs/ClangCommandLineReference.rst 
b/clang/docs/ClangCommandLineReference.rst
index 31e7cd342c267..94eb3fec8a23c 100644
--- a/clang/docs/ClangCommandLineReference.rst
+++ b/clang/docs/ClangCommandLineReference.rst
@@ -483,7 +483,7 @@ Enable migration to use NS\_NONATOMIC\_IOSONLY macro for 
setting property's 'ato
 
 Enable migration to annotate property with NS\_RETURNS\_INNER\_POINTER
 
-.. option:: -objcmt-whitelist-dir-path=, -objcmt-white-list-dir-path=
+.. option:: -objcmpt-allowlist-dir-path=, 
-objcmt-whitelist-dir-path=, -objcmt-white-list-dir-path=
 
 Only modify files with a filename contained in the provided directory path
 

diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index b4a2411fa5c5c..9a657e948e33e 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -617,12 +617,15 @@ def objcmt_migrate_designated_init : Flag<["-"], 
"objcmt-migrate-designated-init
   HelpText<"Enable migration to infer NS_DESIGNATED_INITIALIZER for 
initializer methods">,
   MarshallingInfoBitfieldFlag, 
"FrontendOptions::ObjCMT_DesignatedInitializer">;
 
-def objcmt_whitelist_dir_path: Joined<["-"], "objcmt-whitelist-dir-path=">, 
Flags<[CC1Option]>,
+def objcmt_allowlist_dir_path: Joined<["-"], "objcmt-allowlist-dir-path=">, 
Flags<[CC1Option]>,
   HelpText<"Only modify files with a filename contained in the provided 
directory path">,
-  MarshallingInfoString>;
+  MarshallingInfoString>;
+def : Joined<["-"], "objcmt-whitelist-dir-path=">, Flags<[CC1Option]>,
+  HelpText<"Alias for -objcmt-allowlist-dir-path">,
+  Alias;
 // The misspelt "white-list" [sic] alias is due for removal.
 def : Joined<["-"], "objcmt-white-list-dir-path=">, Flags<[CC1Option]>,
-Alias;
+  Alias;
 
 // Make sure all other -ccc- options are rejected.
 def ccc_ : Joined<["-"], "ccc-">, Group, Flags<[Unsupported]>;

diff  --git a/clang/include/clang/Frontend/FrontendOptions.h 
b/clang/include/clang/Frontend/FrontendOptions.h
index 41ea45ca0b103..1d9d89a28c6c4 100644
--- a/clang/include/clang/Frontend/FrontendOptions.h
+++ b/clang/include/clang/Frontend/FrontendOptions.h
@@ -373,7 +373,7 @@ class FrontendOptions {
  ObjCMT_MigrateDecls | ObjCMT_PropertyDotSyntax)
   };
   unsigned ObjCMTAction = ObjCMT_None;
-  std::string ObjCMTWhiteListPath;
+  std::string ObjCMTAllowListPath;
 
   std::string MTMigrateDir;
   std::string ARCMTMigrateReportOut;

diff  --git a/clang/lib/ARCMigrate/ObjCMT.cpp b/clang/lib/ARCMigrate/ObjCMT.cpp
index e99c6435062fb..3dfa9a0218a73 100644
--- a/clang/lib/ARCMigrate/ObjCMT.cpp
+++ b/clang/lib/ARCMigrate/ObjCMT.cpp
@@ -104,7 +104,7 @@ class ObjCMigrateASTConsumer : public ASTConsumer {
   bool FoundationIncluded;
   llvm::SmallPtrSet ObjCProtocolDecls;
   llvm::SmallVector CFFunctionIBCandidates;
-  llvm::StringSet<> WhiteListFilenames;
+  llvm::StringSet<> AllowListFilenames;
 
   RetainSummaryManager (ASTContext ) {
 if (!Summaries)
@@ -118,14 

[clang] 8659b24 - [clang][NFC] Inclusive terms: Replace uses of whitelist in clang/lib/StaticAnalyzer

2021-10-29 Thread Zarko Todorovski via cfe-commits

Author: Zarko Todorovski
Date: 2021-10-29T16:51:36-04:00
New Revision: 8659b241ae945632e2a1c3294073d0fdeacfdbde

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

LOG: [clang][NFC] Inclusive terms: Replace uses of whitelist in 
clang/lib/StaticAnalyzer

Replace variable and functions names, as well as comments that contain 
whitelist with
more inclusive terms.

Reviewed By: aaron.ballman, martong

Differential Revision: https://reviews.llvm.org/D112642

Added: 


Modified: 
clang/lib/StaticAnalyzer/Checkers/EnumCastOutOfRangeChecker.cpp
clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp
clang/lib/StaticAnalyzer/Checkers/VforkChecker.cpp
clang/lib/StaticAnalyzer/Checkers/WebKit/ASTUtils.h
clang/lib/StaticAnalyzer/Core/MemRegion.cpp
clang/test/Analysis/vfork.c

Removed: 




diff  --git a/clang/lib/StaticAnalyzer/Checkers/EnumCastOutOfRangeChecker.cpp 
b/clang/lib/StaticAnalyzer/Checkers/EnumCastOutOfRangeChecker.cpp
index 0e94b915a468f..e5088fb266bc2 100644
--- a/clang/lib/StaticAnalyzer/Checkers/EnumCastOutOfRangeChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/EnumCastOutOfRangeChecker.cpp
@@ -94,10 +94,10 @@ void EnumCastOutOfRangeChecker::checkPreStmt(const CastExpr 
*CE,
 
   // Only perform enum range check on casts where such checks are valid.  For
   // all other cast kinds (where enum range checks are unnecessary or invalid),
-  // just return immediately.  TODO: The set of casts whitelisted for enum
-  // range checking may be incomplete.  Better to add a missing cast kind to
-  // enable a missing check than to generate false negatives and have to remove
-  // those later.
+  // just return immediately.  TODO: The set of casts allowed for enum range
+  // checking may be incomplete.  Better to add a missing cast kind to enable a
+  // missing check than to generate false negatives and have to remove those
+  // later.
   switch (CE->getCastKind()) {
   case CK_IntegralCast:
 break;

diff  --git 
a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp 
b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp
index 3f3267ff93916..b256117fd78dc 100644
--- 
a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp
+++ 
b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp
@@ -1188,14 +1188,14 @@ ProgramStateRef RetainCountChecker::checkRegionChanges(
   if (!invalidated)
 return state;
 
-  llvm::SmallPtrSet WhitelistedSymbols;
+  llvm::SmallPtrSet AllowedSymbols;
 
   for (const MemRegion *I : ExplicitRegions)
 if (const SymbolicRegion *SR = I->StripCasts()->getAs())
-  WhitelistedSymbols.insert(SR->getSymbol());
+  AllowedSymbols.insert(SR->getSymbol());
 
   for (SymbolRef sym : *invalidated) {
-if (WhitelistedSymbols.count(sym))
+if (AllowedSymbols.count(sym))
   continue;
 // Remove any existing reference-count binding.
 state = removeRefBinding(state, sym);

diff  --git a/clang/lib/StaticAnalyzer/Checkers/VforkChecker.cpp 
b/clang/lib/StaticAnalyzer/Checkers/VforkChecker.cpp
index 8f147026ae192..04e6603b4cbeb 100644
--- a/clang/lib/StaticAnalyzer/Checkers/VforkChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/VforkChecker.cpp
@@ -9,7 +9,7 @@
 //  This file defines vfork checker which checks for dangerous uses of vfork.
 //  Vforked process shares memory (including stack) with parent so it's
 //  range of actions is significantly limited: can't write variables,
-//  can't call functions not in whitelist, etc. For more details, see
+//  can't call functions not in the allowed list, etc. For more details, see
 //  http://man7.org/linux/man-pages/man2/vfork.2.html
 //
 //  This checker checks for prohibited constructs in vforked process.
@@ -44,13 +44,14 @@ namespace {
 class VforkChecker : public Checker> {
   mutable std::unique_ptr BT;
-  mutable llvm::SmallSet VforkWhitelist;
+  mutable llvm::SmallSet VforkAllowlist;
   mutable const IdentifierInfo *II_vfork;
 
   static bool isChildProcess(const ProgramStateRef State);
 
   bool isVforkCall(const Decl *D, CheckerContext ) const;
-  bool isCallWhitelisted(const IdentifierInfo *II, CheckerContext ) const;
+  bool isCallExplicitelyAllowed(const IdentifierInfo *II,
+CheckerContext ) const;
 
   void reportBug(const char *What, CheckerContext ,
  const char *Details = nullptr) const;
@@ -93,9 +94,9 @@ bool VforkChecker::isVforkCall(const Decl *D, CheckerContext 
) const {
 }
 
 // Returns true iff ok to call function after successful vfork.
-bool VforkChecker::isCallWhitelisted(const IdentifierInfo *II,
- CheckerContext ) const {
-  if (VforkWhitelist.empty()) {
+bool 

[clang] c001775 - [clang] Inclusive language: change error message to use allowlist

2021-10-29 Thread Zarko Todorovski via cfe-commits

Author: Zarko Todorovski
Date: 2021-10-29T13:12:46-04:00
New Revision: c001775a3afb124b9b19ff5a45a68d4baf130077

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

LOG: [clang] Inclusive language: change error message to use allowlist

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D112627

Added: 


Modified: 
clang/include/clang/Basic/DiagnosticDriverKinds.td
clang/lib/Driver/SanitizerArgs.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td 
b/clang/include/clang/Basic/DiagnosticDriverKinds.td
index e013cf25db809..b823ade0eafb5 100644
--- a/clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -187,8 +187,8 @@ def err_drv_invalid_argument_to_option : Error<
   "invalid argument '%0' to -%1">;
 def err_drv_malformed_sanitizer_ignorelist : Error<
   "malformed sanitizer ignorelist: '%0'">;
-def err_drv_malformed_sanitizer_coverage_whitelist : Error<
-  "malformed sanitizer coverage whitelist: '%0'">;
+def err_drv_malformed_sanitizer_coverage_allowlist : Error<
+  "malformed sanitizer coverage allowlist: '%0'">;
 def err_drv_malformed_sanitizer_coverage_ignorelist : Error<
   "malformed sanitizer coverage ignorelist: '%0'">;
 def err_drv_duplicate_config : Error<

diff  --git a/clang/lib/Driver/SanitizerArgs.cpp 
b/clang/lib/Driver/SanitizerArgs.cpp
index 44692e131d3e1..6f426c6cad69c 100644
--- a/clang/lib/Driver/SanitizerArgs.cpp
+++ b/clang/lib/Driver/SanitizerArgs.cpp
@@ -756,7 +756,7 @@ SanitizerArgs::SanitizerArgs(const ToolChain ,
 parseSpecialCaseListArg(
 D, Args, CoverageAllowlistFiles,
 options::OPT_fsanitize_coverage_allowlist, OptSpecifier(),
-clang::diag::err_drv_malformed_sanitizer_coverage_whitelist);
+clang::diag::err_drv_malformed_sanitizer_coverage_allowlist);
 parseSpecialCaseListArg(
 D, Args, CoverageIgnorelistFiles,
 options::OPT_fsanitize_coverage_ignorelist, OptSpecifier(),



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 1b0a71c - [PowerPC][AIX] Add support for varargs for complex types on AIX

2021-09-16 Thread Zarko Todorovski via cfe-commits

Author: Zarko Todorovski
Date: 2021-09-16T09:38:03-04:00
New Revision: 1b0a71c5fc052322a45a8cb9a9fcaa2c36105b89

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

LOG: [PowerPC][AIX] Add support for varargs for complex types on AIX

Remove the previous error and add support for special handling of small
complex types as in PPC64 ELF ABI. As in, generate code to load from
varargs location and pack it in a temp variable, then return a pointer to
the struct.

Reviewed By: sfertile

Differential Revision: https://reviews.llvm.org/D106393

Added: 
clang/test/CodeGen/aix32-complex-varargs.c

Modified: 
clang/lib/CodeGen/TargetInfo.cpp
clang/test/CodeGen/ppc64-varargs-complex.c

Removed: 




diff  --git a/clang/lib/CodeGen/TargetInfo.cpp 
b/clang/lib/CodeGen/TargetInfo.cpp
index 5d33403f1233..67d0c2b5c850 100644
--- a/clang/lib/CodeGen/TargetInfo.cpp
+++ b/clang/lib/CodeGen/TargetInfo.cpp
@@ -392,6 +392,36 @@ static Address emitVoidPtrVAArg(CodeGenFunction , 
Address VAListAddr,
 
 }
 
+static Address complexTempStructure(CodeGenFunction , Address VAListAddr,
+QualType Ty, CharUnits SlotSize,
+CharUnits EltSize, const ComplexType *CTy) 
{
+  Address Addr =
+  emitVoidPtrDirectVAArg(CGF, VAListAddr, CGF.Int8Ty, SlotSize * 2,
+ SlotSize, SlotSize, /*AllowHigher*/ true);
+
+  Address RealAddr = Addr;
+  Address ImagAddr = RealAddr;
+  if (CGF.CGM.getDataLayout().isBigEndian()) {
+RealAddr =
+CGF.Builder.CreateConstInBoundsByteGEP(RealAddr, SlotSize - EltSize);
+ImagAddr = CGF.Builder.CreateConstInBoundsByteGEP(ImagAddr,
+  2 * SlotSize - EltSize);
+  } else {
+ImagAddr = CGF.Builder.CreateConstInBoundsByteGEP(RealAddr, SlotSize);
+  }
+
+  llvm::Type *EltTy = CGF.ConvertTypeForMem(CTy->getElementType());
+  RealAddr = CGF.Builder.CreateElementBitCast(RealAddr, EltTy);
+  ImagAddr = CGF.Builder.CreateElementBitCast(ImagAddr, EltTy);
+  llvm::Value *Real = CGF.Builder.CreateLoad(RealAddr, ".vareal");
+  llvm::Value *Imag = CGF.Builder.CreateLoad(ImagAddr, ".vaimag");
+
+  Address Temp = CGF.CreateMemTemp(Ty, "vacplx");
+  CGF.EmitStoreOfComplex({Real, Imag}, CGF.MakeAddrLValue(Temp, Ty),
+ /*init*/ true);
+  return Temp;
+}
+
 static Address emitMergePHI(CodeGenFunction ,
 Address Addr1, llvm::BasicBlock *Block1,
 Address Addr2, llvm::BasicBlock *Block2,
@@ -4631,14 +4661,25 @@ CharUnits AIXABIInfo::getParamTypeAlignment(QualType 
Ty) const {
 
 Address AIXABIInfo::EmitVAArg(CodeGenFunction , Address VAListAddr,
   QualType Ty) const {
-  if (Ty->isAnyComplexType())
-llvm::report_fatal_error("complex type is not supported on AIX yet");
 
   auto TypeInfo = getContext().getTypeInfoInChars(Ty);
   TypeInfo.Align = getParamTypeAlignment(Ty);
 
   CharUnits SlotSize = CharUnits::fromQuantity(PtrByteSize);
 
+  // If we have a complex type and the base type is smaller than the register
+  // size, the ABI calls for the real and imaginary parts to be right-adjusted
+  // in separate words in 32bit mode or doublewords in 64bit mode. However,
+  // Clang expects us to produce a pointer to a structure with the two parts
+  // packed tightly. So generate loads of the real and imaginary parts relative
+  // to the va_list pointer, and store them to a temporary structure. We do the
+  // same as the PPC64ABI here.
+  if (const ComplexType *CTy = Ty->getAs()) {
+CharUnits EltSize = TypeInfo.Width / 2;
+if (EltSize < SlotSize)
+  return complexTempStructure(CGF, VAListAddr, Ty, SlotSize, EltSize, CTy);
+  }
+
   return emitVoidPtrVAArg(CGF, VAListAddr, Ty, /*Indirect*/ false, TypeInfo,
   SlotSize, /*AllowHigher*/ true);
 }
@@ -5406,33 +5447,8 @@ Address PPC64_SVR4_ABIInfo::EmitVAArg(CodeGenFunction 
, Address VAListAddr,
   // and store them to a temporary structure.
   if (const ComplexType *CTy = Ty->getAs()) {
 CharUnits EltSize = TypeInfo.Width / 2;
-if (EltSize < SlotSize) {
-  Address Addr = emitVoidPtrDirectVAArg(CGF, VAListAddr, CGF.Int8Ty,
-SlotSize * 2, SlotSize,
-SlotSize, /*AllowHigher*/ true);
-
-  Address RealAddr = Addr;
-  Address ImagAddr = RealAddr;
-  if (CGF.CGM.getDataLayout().isBigEndian()) {
-RealAddr = CGF.Builder.CreateConstInBoundsByteGEP(RealAddr,
-  SlotSize - EltSize);
-ImagAddr = CGF.Builder.CreateConstInBoundsByteGEP(ImagAddr,
-  

[clang] 66225db - [PowerPC][AIX] Add warning when alignment is incompatible with XL

2021-07-16 Thread Zarko Todorovski via cfe-commits

Author: Zarko Todorovski
Date: 2021-07-16T07:52:47-04:00
New Revision: 66225db98d832bec75ffb96298107c015b0035f0

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

LOG: [PowerPC][AIX] Add warning when alignment is incompatible with XL

https://reviews.llvm.org/D105659 implements ByVal handling in llc but
some cases are not compatible with existing XL compiler on AIX.  Adding
a clang warning for such cases.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D105660

Added: 
clang/test/Sema/aix-attr-align.c

Modified: 
clang/include/clang/Basic/DiagnosticGroups.td
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/Sema/SemaDeclAttr.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/DiagnosticGroups.td 
b/clang/include/clang/Basic/DiagnosticGroups.td
index 18097cfcfffe..eb1b5641bfdf 100644
--- a/clang/include/clang/Basic/DiagnosticGroups.td
+++ b/clang/include/clang/Basic/DiagnosticGroups.td
@@ -1083,6 +1083,9 @@ def GNU : DiagGroup<"gnu", [GNUAlignofExpression, 
GNUAnonymousStruct,
 // A warning group for warnings about code that clang accepts but gcc doesn't.
 def GccCompat : DiagGroup<"gcc-compat">;
 
+// A warning group for warnings about code that may be incompatible on AIX.
+def AIXCompat : DiagGroup<"aix-compat">;
+
 // Warnings for Microsoft extensions.
 def MicrosoftCharize : DiagGroup<"microsoft-charize">;
 def MicrosoftDrectveSection : DiagGroup<"microsoft-drectve-section">;

diff  --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index 779093977da8..823a36a597c5 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -3254,6 +3254,10 @@ def warn_assume_aligned_too_great
 : Warning<"requested alignment must be %0 bytes or smaller; maximum "
   "alignment assumed">,
   InGroup>;
+def warn_not_xl_compatible
+: Warning<"requesting an alignment of 16 bytes or greater for struct"
+  " members is not binary compatible with AIX XL 16.1 and older">,
+  InGroup;
 def warn_redeclaration_without_attribute_prev_attribute_ignored : Warning<
   "%q0 redeclared without %1 attribute: previous %1 ignored">,
   InGroup;

diff  --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index 3586ad323b8e..9aac9d215644 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -3953,6 +3953,12 @@ void Sema::AddAlignedAttr(Decl *D, const 
AttributeCommonInfo , Expr *E,
 return;
 
   uint64_t AlignVal = Alignment.getZExtValue();
+  // 16 byte ByVal alignment not due to a vector member is not honoured by XL
+  // on AIX. Emit a warning here that users are generating binary incompatible
+  // code to be safe.
+  if (AlignVal >= 16 && isa(D) &&
+  Context.getTargetInfo().getTriple().isOSAIX())
+Diag(AttrLoc, diag::warn_not_xl_compatible) << E->getSourceRange();
 
   // C++11 [dcl.align]p2:
   //   -- if the constant expression evaluates to zero, the alignment

diff  --git a/clang/test/Sema/aix-attr-align.c 
b/clang/test/Sema/aix-attr-align.c
new file mode 100644
index ..ac70aab66900
--- /dev/null
+++ b/clang/test/Sema/aix-attr-align.c
@@ -0,0 +1,22 @@
+// off-no-diagnostics
+// RUN: %clang_cc1 -triple powerpc64-ibm-aix-xcoff -verify -fsyntax-only %s
+// RUN: %clang_cc1 -triple powerpc-ibm-aix-xcoff -verify -fsyntax-only %s
+// RUN: %clang_cc1 -triple powerpc64-ibm-aix-xcoff -verify=off -Wno-aix-compat 
-fsyntax-only %s
+// RUN: %clang_cc1 -triple powerpc-ibm-aix-xcoff -verify=off -Wno-aix-compat 
-fsyntax-only %s
+// RUN: %clang_cc1 -triple powerpc64le-unknown-linux -verify=off -fsyntax-only 
%s
+
+struct S {
+  int a[8] __attribute__((aligned(8))); // no-warning
+};
+
+struct T {
+  int a[4] __attribute__((aligned(16))); // expected-warning {{requesting an 
alignment of 16 bytes or greater for struct members is not binary compatible 
with AIX XL 16.1 and older}}
+};
+
+struct U {
+  int a[2] __attribute__((aligned(32))); // expected-warning {{requesting an 
alignment of 16 bytes or greater for struct members is not binary compatible 
with AIX XL 16.1 and older}}
+};
+
+int a[8] __attribute__((aligned(8)));  // no-warning
+int b[4] __attribute__((aligned(16))); // no-warning
+int c[2] __attribute__((aligned(32))); // no-warning



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 76c931a - [AIX][PowerPC] Remove error when specifying mabi=vec-default on AIX

2021-06-23 Thread Zarko Todorovski via cfe-commits

Author: Zarko Todorovski
Date: 2021-06-23T07:40:38-04:00
New Revision: 76c931ae42cf1080199a238446306e8554ebb6de

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

LOG: [AIX][PowerPC] Remove error when specifying mabi=vec-default on AIX

The default Altivec ABI was implemented but the clang error for specifying
its use still remains.  Users could get around this but not specifying the
type of Altivec ABI but we need to remove the error.

Reviewed By: jsji

Differential Revision: https://reviews.llvm.org/D102094

Added: 
clang/test/Driver/aix-vec_extabi.c

Modified: 
clang/include/clang/Basic/DiagnosticDriverKinds.td
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/CodeGen/altivec.c
clang/test/Preprocessor/aix-vec_extabi.c

Removed: 
clang/test/Driver/aix-vec-extabi.c



diff  --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td 
b/clang/include/clang/Basic/DiagnosticDriverKinds.td
index 6e4a60156fef7..c7da9713b1e4e 100644
--- a/clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -542,9 +542,6 @@ def err_drv_cannot_mix_options : Error<"cannot specify '%1' 
along with '%0'">;
 
 def err_drv_invalid_object_mode : Error<"OBJECT_MODE setting %0 is not 
recognized and is not a valid setting.">;
 
-def err_aix_default_altivec_abi : Error<
-  "The default Altivec ABI on AIX is not yet supported, use '-mabi=vec-extabi' 
for the extended Altivec ABI">;
-
 def err_aix_unsupported_tls_model : Error<"TLS model '%0' is not yet supported 
on AIX">;
 
 def err_invalid_cxx_abi : Error<"Invalid C++ ABI name '%0'">;

diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index eafe5de8eedb8..b358813a1a017 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -4823,7 +4823,7 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
 if (A->getOption().getID() == options::OPT_mabi_EQ_vec_extabi)
   CmdArgs.push_back("-mabi=vec-extabi");
 else
-  D.Diag(diag::err_aix_default_altivec_abi);
+  CmdArgs.push_back("-mabi=vec-default");
   }
 
   if (Arg *A = Args.getLastArg(options::OPT_Wframe_larger_than_EQ)) {

diff  --git a/clang/lib/Frontend/CompilerInvocation.cpp 
b/clang/lib/Frontend/CompilerInvocation.cpp
index 5bbb954c7d4d7..c1b7b027b3b4d 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -1859,13 +1859,7 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions 
, ArgList ,
   << A->getSpelling() << T.str();
 
 const Option  = A->getOption();
-if (O.matches(OPT_mabi_EQ_vec_default))
-  Diags.Report(diag::err_aix_default_altivec_abi)
-  << A->getSpelling() << T.str();
-else {
-  assert(O.matches(OPT_mabi_EQ_vec_extabi));
-  Opts.EnableAIXExtendedAltivecABI = 1;
-}
+Opts.EnableAIXExtendedAltivecABI = O.matches(OPT_mabi_EQ_vec_extabi);
   }
 
   bool NeedLocTracking = false;

diff  --git a/clang/test/CodeGen/altivec.c b/clang/test/CodeGen/altivec.c
index 86b570f15d080..af239b54711c1 100644
--- a/clang/test/CodeGen/altivec.c
+++ b/clang/test/CodeGen/altivec.c
@@ -4,12 +4,12 @@
 // RUN: %clang_cc1 -target-feature +altivec -triple 
powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s 
--check-prefixes=CHECK,CHECK-LE
 // RUN: %clang_cc1 -target-feature +altivec -mabi=vec-extabi -target-cpu pwr8 
-triple powerpc-unknown-aix -emit-llvm %s -o - | FileCheck %s 
--check-prefixes=CHECK,CHECK-BE
 // RUN: %clang_cc1 -target-feature +altivec -mabi=vec-extabi -target-cpu pwr8 
-triple powerpc64-unknown-aix -emit-llvm %s -o - | FileCheck %s 
--check-prefixes=CHECK,CHECK-BE
-// RUN: not %clang_cc1 -target-feature +altivec -mabi=vec-default -target-cpu 
pwr8 -triple powerpc-unknown-aix -emit-llvm %s 2>&1 | FileCheck %s 
--check-prefix=AIX-ERROR
-// RUN: not %clang_cc1 -target-feature +altivec -mabi=vec-default -target-cpu 
pwr8 -triple powerpc64-unknown-aix -emit-llvm %s 2>&1 | FileCheck %s 
--check-prefix=AIX-ERROR
-// RUN: %clang -S -emit-llvm -maltivec -mabi=vec-extabi -mcpu=pwr8 -target 
powerpc-unknown-aix %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-BE
-// RUN: %clang -S -emit-llvm -maltivec -mabi=vec-extabi -mcpu=pwr8 -target 
powerpc64-unknown-aix %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-BE
-// RUN: not %clang -S -emit-llvm -maltivec -mabi=vec-default -mcpu=pwr8 
-triple powerpc-unknown-aix -emit-llvm %s 2>&1 | FileCheck %s 
--check-prefix=AIX-ERROR
-// RUN: not %clang -S -emit-llvm -maltivec -mabi=vec-default -mcpu=pwr8 
-triple powerpc64-unknown-aix -emit-llvm %s 2>&1 | FileCheck %s 
--check-prefix=AIX-ERROR
+// RUN: %clang_cc1 -target-feature +altivec 

[clang] 8fa168f - Parse vector bool when stdbool.h and altivec.h are included

2021-05-13 Thread Zarko Todorovski via cfe-commits

Author: Zarko Todorovski
Date: 2021-05-13T11:48:32-04:00
New Revision: 8fa168fc50ba4f63b79773c947ef5b3e43d5c02f

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

LOG: Parse vector bool when stdbool.h and altivec.h are included

Currently when including stdbool.h and altivec.h declaration of `vector bool` 
leads to
errors due to `bool` being expanded to '_Bool`. This patch allows the parser
to recognize `_Bool`.

Reviewed By: hubert.reinterpretcast, Everybody0523

Differential Revision: https://reviews.llvm.org/D102064

Added: 
clang/test/Parser/altivec-zvector-bool.c

Modified: 
clang/include/clang/Parse/Parser.h
clang/lib/Parse/ParseDecl.cpp
clang/lib/Parse/Parser.cpp

Removed: 




diff  --git a/clang/include/clang/Parse/Parser.h 
b/clang/include/clang/Parse/Parser.h
index b5d6212e2dd41..213f7fb3dc56f 100644
--- a/clang/include/clang/Parse/Parser.h
+++ b/clang/include/clang/Parse/Parser.h
@@ -118,10 +118,12 @@ class Parser : public CodeCompletionHandler {
   /// Ident_super - IdentifierInfo for "super", to support fast
   /// comparison.
   IdentifierInfo *Ident_super;
-  /// Ident_vector, Ident_bool - cached IdentifierInfos for "vector" and
-  /// "bool" fast comparison.  Only present if AltiVec or ZVector are enabled.
+  /// Ident_vector, Ident_bool, Ident_Bool - cached IdentifierInfos for 
"vector"
+  /// and "bool" fast comparison.  Only present if AltiVec or ZVector are
+  /// enabled.
   IdentifierInfo *Ident_vector;
   IdentifierInfo *Ident_bool;
+  IdentifierInfo *Ident_Bool;
   /// Ident_pixel - cached IdentifierInfos for "pixel" fast comparison.
   /// Only present if AltiVec enabled.
   IdentifierInfo *Ident_pixel;
@@ -879,6 +881,7 @@ class Parser : public CodeCompletionHandler {
 
 if (Tok.getIdentifierInfo() != Ident_vector &&
 Tok.getIdentifierInfo() != Ident_bool &&
+Tok.getIdentifierInfo() != Ident_Bool &&
 (!getLangOpts().AltiVec || Tok.getIdentifierInfo() != Ident_pixel))
   return false;
 

diff  --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index 928ef33bc9f20..fda427508c056 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -7334,6 +7334,7 @@ bool Parser::TryAltiVecVectorTokenOutOfLine() {
   case tok::kw_float:
   case tok::kw_double:
   case tok::kw_bool:
+  case tok::kw__Bool:
   case tok::kw___bool:
   case tok::kw___pixel:
 Tok.setKind(tok::kw___vector);
@@ -7343,7 +7344,8 @@ bool Parser::TryAltiVecVectorTokenOutOfLine() {
   Tok.setKind(tok::kw___vector);
   return true;
 }
-if (Next.getIdentifierInfo() == Ident_bool) {
+if (Next.getIdentifierInfo() == Ident_bool ||
+Next.getIdentifierInfo() == Ident_Bool) {
   Tok.setKind(tok::kw___vector);
   return true;
 }
@@ -7368,6 +7370,7 @@ bool Parser::TryAltiVecTokenOutOfLine(DeclSpec , 
SourceLocation Loc,
 case tok::kw_float:
 case tok::kw_double:
 case tok::kw_bool:
+case tok::kw__Bool:
 case tok::kw___bool:
 case tok::kw___pixel:
   isInvalid = DS.SetTypeAltiVecVector(true, Loc, PrevSpec, DiagID, Policy);
@@ -7377,8 +7380,10 @@ bool Parser::TryAltiVecTokenOutOfLine(DeclSpec , 
SourceLocation Loc,
 isInvalid = DS.SetTypeAltiVecVector(true, Loc, PrevSpec, 
DiagID,Policy);
 return true;
   }
-  if (Next.getIdentifierInfo() == Ident_bool) {
-isInvalid = DS.SetTypeAltiVecVector(true, Loc, PrevSpec, 
DiagID,Policy);
+  if (Next.getIdentifierInfo() == Ident_bool ||
+  Next.getIdentifierInfo() == Ident_Bool) {
+isInvalid =
+DS.SetTypeAltiVecVector(true, Loc, PrevSpec, DiagID, Policy);
 return true;
   }
   break;

diff  --git a/clang/lib/Parse/Parser.cpp b/clang/lib/Parse/Parser.cpp
index b178b56e967c6..1ae3ed4ff0d39 100644
--- a/clang/lib/Parse/Parser.cpp
+++ b/clang/lib/Parse/Parser.cpp
@@ -503,10 +503,12 @@ void Parser::Initialize() {
 
   Ident_vector = nullptr;
   Ident_bool = nullptr;
+  Ident_Bool = nullptr;
   Ident_pixel = nullptr;
   if (getLangOpts().AltiVec || getLangOpts().ZVector) {
 Ident_vector = ().get("vector");
 Ident_bool = ().get("bool");
+Ident_Bool = ().get("_Bool");
   }
   if (getLangOpts().AltiVec)
 Ident_pixel = ().get("pixel");

diff  --git a/clang/test/Parser/altivec-zvector-bool.c 
b/clang/test/Parser/altivec-zvector-bool.c
new file mode 100644
index 0..6765d26e2df48
--- /dev/null
+++ b/clang/test/Parser/altivec-zvector-bool.c
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -triple=powerpc64-unknown-linux-gnu \
+// RUN:-target-feature +altivec -fsyntax-only %s
+// RUN: %clang_cc1 -triple=powerpc64le-unknown-linux-gnu \
+// RUN:-target-feature +altivec -fsyntax-only %s
+// RUN: %clang_cc1 

[clang] eb3426a - [AIX] Improve option processing for mabi=vec-extabi and mabi=vec=defaul

2021-02-02 Thread Zarko Todorovski via cfe-commits

Author: Zarko Todorovski
Date: 2021-02-02T10:59:21-05:00
New Revision: eb3426a528d5b3cbbb54aee662a779f2067fc9db

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

LOG: [AIX] Improve option processing for mabi=vec-extabi and mabi=vec=defaul

Opening this revision to better address comments by @hubert.reinterpretcast in 
https://reviews.llvm.org/rGcaaaebcde462

Reviewed By: hubert.reinterpretcast

Differential Revision: https://reviews.llvm.org/D95702

Added: 


Modified: 
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/CodeGen/altivec.c

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 431f534c38fe..e2b9dc29868a 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -4669,23 +4669,15 @@ void Clang::ConstructJob(Compilation , const 
JobAction ,
 }
   }
 
-  if (Triple.isOSAIX() && Args.hasArg(options::OPT_maltivec)) {
-if (Args.getLastArg(options::OPT_mabi_EQ_vec_extabi)) {
-  CmdArgs.push_back("-mabi=vec-extabi");
-} else {
-  D.Diag(diag::err_aix_default_altivec_abi);
-}
-  }
-
   if (Arg *A = Args.getLastArg(options::OPT_mabi_EQ_vec_extabi,
options::OPT_mabi_EQ_vec_default)) {
 if (!Triple.isOSAIX())
   D.Diag(diag::err_drv_unsupported_opt_for_target)
   << A->getSpelling() << RawTriple.str();
-if (A->getOption().getID() == options::OPT_mabi_EQ_vec_default)
-  D.Diag(diag::err_aix_default_altivec_abi);
 if (A->getOption().getID() == options::OPT_mabi_EQ_vec_extabi)
   CmdArgs.push_back("-mabi=vec-extabi");
+else
+  D.Diag(diag::err_aix_default_altivec_abi);
   }
 
   if (Arg *A = Args.getLastArg(options::OPT_Wframe_larger_than_EQ)) {

diff  --git a/clang/test/CodeGen/altivec.c b/clang/test/CodeGen/altivec.c
index d69c34d82190..86b570f15d08 100644
--- a/clang/test/CodeGen/altivec.c
+++ b/clang/test/CodeGen/altivec.c
@@ -6,9 +6,6 @@
 // RUN: %clang_cc1 -target-feature +altivec -mabi=vec-extabi -target-cpu pwr8 
-triple powerpc64-unknown-aix -emit-llvm %s -o - | FileCheck %s 
--check-prefixes=CHECK,CHECK-BE
 // RUN: not %clang_cc1 -target-feature +altivec -mabi=vec-default -target-cpu 
pwr8 -triple powerpc-unknown-aix -emit-llvm %s 2>&1 | FileCheck %s 
--check-prefix=AIX-ERROR
 // RUN: not %clang_cc1 -target-feature +altivec -mabi=vec-default -target-cpu 
pwr8 -triple powerpc64-unknown-aix -emit-llvm %s 2>&1 | FileCheck %s 
--check-prefix=AIX-ERROR
-
-// RUN: not %clang -S -emit-llvm -maltivec -mcpu=pwr8 -target 
powerpc-unknown-aix %s 2>&1 | FileCheck %s --check-prefix=AIX-ERROR
-// RUN: not %clang -S -emit-llvm -maltivec -mcpu=pwr8 -target 
powerpc64-unknown-aix %s 2>&1 | FileCheck %s --check-prefix=AIX-ERROR 
 // RUN: %clang -S -emit-llvm -maltivec -mabi=vec-extabi -mcpu=pwr8 -target 
powerpc-unknown-aix %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-BE
 // RUN: %clang -S -emit-llvm -maltivec -mabi=vec-extabi -mcpu=pwr8 -target 
powerpc64-unknown-aix %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-BE
 // RUN: not %clang -S -emit-llvm -maltivec -mabi=vec-default -mcpu=pwr8 
-triple powerpc-unknown-aix -emit-llvm %s 2>&1 | FileCheck %s 
--check-prefix=AIX-ERROR



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] caaaebc - [AIX] Actually push back "-mabi=vec-extabi" when option is on.

2021-01-29 Thread Zarko Todorovski via cfe-commits

Author: Zarko Todorovski
Date: 2021-01-29T14:12:46-05:00
New Revision: caaaebcde462bf681498ce85c2659d683a07fc87

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

LOG: [AIX] Actually push back "-mabi=vec-extabi" when option is on.

Accidentaly ommitted the portion of pushing back the option in
https://reviews.llvm.org/D94986

Added: 


Modified: 
clang/lib/Driver/ToolChains/Clang.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index b0379aece75b..431f534c38fe 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -4684,6 +4684,8 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   << A->getSpelling() << RawTriple.str();
 if (A->getOption().getID() == options::OPT_mabi_EQ_vec_default)
   D.Diag(diag::err_aix_default_altivec_abi);
+if (A->getOption().getID() == options::OPT_mabi_EQ_vec_extabi)
+  CmdArgs.push_back("-mabi=vec-extabi");
   }
 
   if (Arg *A = Args.getLastArg(options::OPT_Wframe_larger_than_EQ)) {



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] bc7b268 - Add -fintegrated-as to second invocation of clang in test case.

2020-11-30 Thread Zarko Todorovski via cfe-commits

Author: Zarko Todorovski
Date: 2020-11-30T12:15:25-05:00
New Revision: bc7b2688d6762687ab4ec103d214ce5bb5d4210f

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

LOG: Add -fintegrated-as to second invocation of clang in test case.

Added: 


Modified: 
clang/test/Driver/report-stat.c

Removed: 




diff  --git a/clang/test/Driver/report-stat.c b/clang/test/Driver/report-stat.c
index 621b99384b27..3662d0df47cc 100644
--- a/clang/test/Driver/report-stat.c
+++ b/clang/test/Driver/report-stat.c
@@ -1,6 +1,6 @@
 // RUN: %clang -c -fproc-stat-report -fintegrated-as %s | FileCheck %s
 // CHECK: clang{{.*}}: output={{.*}}.o, total={{[0-9.]+}} ms, user={{[0-9.]+}} 
ms, mem={{[0-9]+}} Kb
 
-// RUN: %clang -c -fproc-stat-report=%t %s
+// RUN: %clang -c -fintegrated-as -fproc-stat-report=%t %s
 // RUN: cat %t | FileCheck --check-prefix=CSV %s
 // CSV: clang{{.*}},"{{.*}}.o",{{[0-9]+}},{{[0-9]+}},{{[0-9]+}}



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 979bcbd - Add -fintegrated-as to clang invocation

2020-11-27 Thread Zarko Todorovski via cfe-commits

Author: Zarko Todorovski
Date: 2020-11-27T15:54:37-05:00
New Revision: 979bcbd3a6f7ea784f2098ad4cf613fbd6b09e38

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

LOG: Add -fintegrated-as to clang invocation

On platforms where the integrated as isn't called by default this
test fails since the output is not what it expects.  Adding this
option generates the expected output on those platforms as well.

Added: 


Modified: 
clang/test/Driver/report-stat.c

Removed: 




diff  --git a/clang/test/Driver/report-stat.c b/clang/test/Driver/report-stat.c
index 4b53f90d8733..621b99384b27 100644
--- a/clang/test/Driver/report-stat.c
+++ b/clang/test/Driver/report-stat.c
@@ -1,4 +1,4 @@
-// RUN: %clang -c -fproc-stat-report %s | FileCheck %s
+// RUN: %clang -c -fproc-stat-report -fintegrated-as %s | FileCheck %s
 // CHECK: clang{{.*}}: output={{.*}}.o, total={{[0-9.]+}} ms, user={{[0-9.]+}} 
ms, mem={{[0-9]+}} Kb
 
 // RUN: %clang -c -fproc-stat-report=%t %s



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] ff8e8c1 - [AIX] Enabling vector type arguments and return for AIX

2020-11-27 Thread Zarko Todorovski via cfe-commits

Author: Zarko Todorovski
Date: 2020-11-27T09:55:52-05:00
New Revision: ff8e8c1b14eafbcdc2778dcf1c9fc12c82f078d7

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

LOG: [AIX] Enabling vector type arguments and return for AIX

This patch enables vector type arguments on AIX.  All non-aggregate Altivec 
vector types are 16bytes in size and are 16byte aligned.

Reviewed By: Xiangling_L

Differential Revision: https://reviews.llvm.org/D92117

Added: 
clang/test/CodeGen/aix-altivec.c

Modified: 
clang/lib/CodeGen/TargetInfo.cpp

Removed: 
clang/test/CodeGen/aix-vector.c



diff  --git a/clang/lib/CodeGen/TargetInfo.cpp 
b/clang/lib/CodeGen/TargetInfo.cpp
index 06b24c0384d8..3469bc6bf081 100644
--- a/clang/lib/CodeGen/TargetInfo.cpp
+++ b/clang/lib/CodeGen/TargetInfo.cpp
@@ -4514,7 +4514,7 @@ ABIArgInfo AIXABIInfo::classifyReturnType(QualType RetTy) 
const {
 return ABIArgInfo::getDirect();
 
   if (RetTy->isVectorType())
-llvm::report_fatal_error("vector type is not supported on AIX yet");
+return ABIArgInfo::getDirect();
 
   if (RetTy->isVoidType())
 return ABIArgInfo::getIgnore();
@@ -4533,7 +4533,7 @@ ABIArgInfo AIXABIInfo::classifyArgumentType(QualType Ty) 
const {
 return ABIArgInfo::getDirect();
 
   if (Ty->isVectorType())
-llvm::report_fatal_error("vector type is not supported on AIX yet");
+return ABIArgInfo::getDirect();
 
   if (isAggregateTypeForABI(Ty)) {
 // Records with non-trivial destructors/copy-constructors should not be
@@ -4558,7 +4558,7 @@ CharUnits AIXABIInfo::getParamTypeAlignment(QualType Ty) 
const {
 Ty = CTy->getElementType();
 
   if (Ty->isVectorType())
-llvm::report_fatal_error("vector type is not supported on AIX yet");
+return CharUnits::fromQuantity(16);
 
   // If the structure contains a vector type, the alignment is 16.
   if (isRecordWithSIMDVectorType(getContext(), Ty))
@@ -4573,7 +4573,8 @@ Address AIXABIInfo::EmitVAArg(CodeGenFunction , 
Address VAListAddr,
 llvm::report_fatal_error("complex type is not supported on AIX yet");
 
   if (Ty->isVectorType())
-llvm::report_fatal_error("vector type is not supported on AIX yet");
+llvm::report_fatal_error(
+"vector types are not yet supported for variadic functions on AIX");
 
   auto TypeInfo = getContext().getTypeInfoInChars(Ty);
   TypeInfo.Align = getParamTypeAlignment(Ty);

diff  --git a/clang/test/CodeGen/aix-altivec.c 
b/clang/test/CodeGen/aix-altivec.c
new file mode 100644
index ..011aa47b6317
--- /dev/null
+++ b/clang/test/CodeGen/aix-altivec.c
@@ -0,0 +1,44 @@
+// REQUIRES: powerpc-registered-target
+// RUN: %clang_cc1 -triple powerpc64-unknown-aix -target-feature +altivec 
-target-cpu pwr8 -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple powerpc-unknown-aix -target-feature +altivec 
-target-cpu pwr8 -emit-llvm %s -o - | FileCheck %s
+vector float foo1(vector float x) { return x; }
+// CHECK:  define <4 x float> @foo1(<4 x float> %x) [[ATTR:#[0-9]+]] {
+// CHECK:  entry:
+// CHECK:%x.addr = alloca <4 x float>, align 16
+// CHECK:store <4 x float> %x, <4 x float>* %x.addr, align 16
+// CHECK:%0 = load <4 x float>, <4 x float>* %x.addr, align 16
+// CHECK:ret <4 x float> %0
+// CHECK:  }
+vector double foo2(vector double x) { return x; }
+// CHECK:  define <2 x double> @foo2(<2 x double> %x) [[ATTR]] {
+// CHECK:  entry:
+// CHECK:%x.addr = alloca <2 x double>, align 16
+// CHECK:store <2 x double> %x, <2 x double>* %x.addr, align 16
+// CHECK:%0 = load <2 x double>, <2 x double>* %x.addr, align 16
+// CHECK:ret <2 x double> %0
+// CHECK:  }
+vector int foo3(vector int x) { return x; }
+// CHECK:  define <4 x i32> @foo3(<4 x i32> %x) [[ATTR]] {
+// CHECK:  entry:
+// CHECK:%x.addr = alloca <4 x i32>, align 16
+// CHECK:store <4 x i32> %x, <4 x i32>* %x.addr, align 16
+// CHECK:%0 = load <4 x i32>, <4 x i32>* %x.addr, align 16
+// CHECK:ret <4 x i32> %0
+// CHECK:  }
+vector short int foo4(vector short int x) { return x; }
+// CHECK:  define <8 x i16> @foo4(<8 x i16> %x) [[ATTR]] {
+// CHECK:  entry:
+// CHECK:%x.addr = alloca <8 x i16>, align 16
+// CHECK:store <8 x i16> %x, <8 x i16>* %x.addr, align 16
+// CHECK:%0 = load <8 x i16>, <8 x i16>* %x.addr, align 16
+// CHECK:ret <8 x i16> %0
+// CHECK:  }
+vector char foo5(vector char x) { return x; }
+// CHECK:  define <16 x i8> @foo5(<16 x i8> %x) [[ATTR]] {
+// CHECK:  entry:
+// CHECK:%x.addr = alloca <16 x i8>, align 16
+// CHECK:store <16 x i8> %x, <16 x i8>* %x.addr, align 16
+// CHECK:%0 = load <16 x i8>, <16 x i8>* %x.addr, align 16
+// CHECK:ret <16 x i8> %0
+// CHECK:  }
+

diff  --git a/clang/test/CodeGen/aix-vector.c b/clang/test/CodeGen/aix-vector.c
deleted file 

[clang] c92f29b - [AIX] Add mabi=vec-extabi options to enable the AIX extended and default vector ABIs.

2020-11-24 Thread Zarko Todorovski via cfe-commits

Author: Zarko Todorovski
Date: 2020-11-24T18:17:53-05:00
New Revision: c92f29b05e68c251b20242daf0898af7cd4982a6

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

LOG: [AIX] Add mabi=vec-extabi options to enable the AIX extended and default 
vector ABIs.

Added support for the options mabi=vec-extabi and mabi=vec-default which are 
analogous to qvecnvol and qnovecnvol when using XL on AIX.
The extended Altivec ABI on AIX is enabled using mabi=vec-extabi in clang and 
vec-extabi in llc.

Reviewed By: Xiangling_L, DiggerLin

Differential Revision: https://reviews.llvm.org/D89684

Added: 
clang/test/Driver/aix-vec-extabi.c
clang/test/Preprocessor/aix-vec_extabi.c
llvm/test/CodeGen/PowerPC/aix-vec-abi.ll

Modified: 
clang/docs/ClangCommandLineReference.rst
clang/include/clang/Basic/CodeGenOptions.def
clang/include/clang/Basic/DiagnosticDriverKinds.td
clang/include/clang/Basic/LangOptions.def
clang/include/clang/Driver/Options.td
clang/lib/Basic/Targets/OSTargets.h
clang/lib/CodeGen/BackendUtil.cpp
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/CodeGen/altivec.c
llvm/include/llvm/CodeGen/CommandFlags.h
llvm/include/llvm/Target/TargetOptions.h
llvm/lib/CodeGen/CommandFlags.cpp
llvm/lib/Target/PowerPC/PPCISelLowering.cpp

Removed: 




diff  --git a/clang/docs/ClangCommandLineReference.rst 
b/clang/docs/ClangCommandLineReference.rst
index 830d3aed0904..3674f3a62695 100644
--- a/clang/docs/ClangCommandLineReference.rst
+++ b/clang/docs/ClangCommandLineReference.rst
@@ -2885,6 +2885,10 @@ Only supported on X86 and RISC-V. Otherwise accepted for 
compatibility with GCC.
 
 .. option:: -municode
 
+.. option:: -mabi=vec-extabi, -mabi=vec-default
+
+Only supported on AIX. Specify usage of the extended vector ABI on AIX and of 
non-volatile vector registers. Defaults to '-mabi=default' when Altivec is 
enabled.
+
 .. option:: -mvx, -mno-vx
 
 .. option:: -mwarn-nonportable-cfstrings, -mno-warn-nonportable-cfstrings

diff  --git a/clang/include/clang/Basic/CodeGenOptions.def 
b/clang/include/clang/Basic/CodeGenOptions.def
index 7cd80aa806db..d90e403915ed 100644
--- a/clang/include/clang/Basic/CodeGenOptions.def
+++ b/clang/include/clang/Basic/CodeGenOptions.def
@@ -49,6 +49,7 @@ CODEGENOPT(UniqueSectionNames, 1, 1) ///< Set for 
-funique-section-names.
 CODEGENOPT(UniqueBasicBlockSectionNames, 1, 1) ///< Set for 
-funique-basic-block-section-names,
///< Produce unique section 
names with
///< basic block sections.
+CODEGENOPT(EnableAIXExtendedAltivecABI, 1, 0) ///< Set for -mabi=vec-extabi. 
Enables the extended Altivec ABI on AIX.
 ENUM_CODEGENOPT(FramePointer, FramePointerKind, 2, FramePointerKind::None) /// 
frame-pointer: all,non-leaf,none
 
 CODEGENOPT(DisableFree   , 1, 0) ///< Don't free memory.

diff  --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td 
b/clang/include/clang/Basic/DiagnosticDriverKinds.td
index 781fcfc6deee..814c30f5fbe7 100644
--- a/clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -531,4 +531,9 @@ def err_drv_invalid_object_mode : Error<"OBJECT_MODE 
setting %0 is not recognize
 
 def err_drv_invalid_sve_vector_bits : Error<
   "'-msve-vector-bits' is not supported without SVE enabled">;
+
+def err_aix_default_altivec_abi : Error<
+  "The default Altivec ABI on AIX is not yet supported, use '-mabi=vec-extabi' 
for the extended Altivec ABI">;
+
+def err_aix_altivec : Error<"'-mabi=vec-extabi' and '-mabi=vec-default' 
require '-maltivec'">;
 }

diff  --git a/clang/include/clang/Basic/LangOptions.def 
b/clang/include/clang/Basic/LangOptions.def
index e4113789f07c..f41febf30c53 100644
--- a/clang/include/clang/Basic/LangOptions.def
+++ b/clang/include/clang/Basic/LangOptions.def
@@ -183,6 +183,7 @@ VALUE_LANGOPT(AlignDouble, 1, 0, "Controls if 
doubles should be alig
 VALUE_LANGOPT(DoubleSize, 32, 0, "width of double")
 VALUE_LANGOPT(LongDoubleSize, 32, 0, "width of long double")
 LANGOPT(PPCIEEELongDouble, 1, 0, "use IEEE 754 quadruple-precision 
for long double")
+LANGOPT(EnableAIXExtendedAltivecABI  , 1, 0, "__EXTABI__  predefined macro")
 COMPATIBLE_VALUE_LANGOPT(PICLevel, 2, 0, "__PIC__ level")
 COMPATIBLE_VALUE_LANGOPT(PIE , 1, 0, "is pie")
 LANGOPT(ROPI , 1, 0, "Read-only position independence")

diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index e7b97f47ee33..88af70116304 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ 

[clang] f330d9f - [PPC] [AIX] Implement calling convention IR for C99 complex types on AIX

2020-09-25 Thread Zarko Todorovski via cfe-commits

Author: Chris Bowler
Date: 2020-09-25T07:43:31-04:00
New Revision: f330d9f163f644b968c6aa5884dc1be5efda20a1

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

LOG: [PPC] [AIX] Implement calling convention IR for C99 complex types on AIX

Add AIX calling convention logic to Clang for C99 complex types on AIX

Differential Revision: https://reviews.llvm.org/D88130

Added: 


Modified: 
clang/lib/CodeGen/TargetInfo.cpp
clang/test/CodeGen/powerpc-c99complex.c

Removed: 
clang/test/CodeGen/aix-complex.c



diff  --git a/clang/lib/CodeGen/TargetInfo.cpp 
b/clang/lib/CodeGen/TargetInfo.cpp
index 2f3f4c281079..6e15cac7359e 100644
--- a/clang/lib/CodeGen/TargetInfo.cpp
+++ b/clang/lib/CodeGen/TargetInfo.cpp
@@ -4504,7 +4504,7 @@ bool AIXABIInfo::isPromotableTypeForABI(QualType Ty) 
const {
 
 ABIArgInfo AIXABIInfo::classifyReturnType(QualType RetTy) const {
   if (RetTy->isAnyComplexType())
-llvm::report_fatal_error("complex type is not supported on AIX yet");
+return ABIArgInfo::getDirect();
 
   if (RetTy->isVectorType())
 llvm::report_fatal_error("vector type is not supported on AIX yet");
@@ -4525,7 +4525,7 @@ ABIArgInfo AIXABIInfo::classifyArgumentType(QualType Ty) 
const {
   Ty = useFirstFieldIfTransparentUnion(Ty);
 
   if (Ty->isAnyComplexType())
-llvm::report_fatal_error("complex type is not supported on AIX yet");
+return ABIArgInfo::getDirect();
 
   if (Ty->isVectorType())
 llvm::report_fatal_error("vector type is not supported on AIX yet");
@@ -4550,8 +4550,9 @@ ABIArgInfo AIXABIInfo::classifyArgumentType(QualType Ty) 
const {
 }
 
 CharUnits AIXABIInfo::getParamTypeAlignment(QualType Ty) const {
-  if (Ty->isAnyComplexType())
-llvm::report_fatal_error("complex type is not supported on AIX yet");
+  // Complex types are passed just like their elements.
+  if (const ComplexType *CTy = Ty->getAs())
+Ty = CTy->getElementType();
 
   if (Ty->isVectorType())
 llvm::report_fatal_error("vector type is not supported on AIX yet");

diff  --git a/clang/test/CodeGen/aix-complex.c 
b/clang/test/CodeGen/aix-complex.c
deleted file mode 100644
index 62ab481a9156..
--- a/clang/test/CodeGen/aix-complex.c
+++ /dev/null
@@ -1,10 +0,0 @@
-// REQUIRES: powerpc-registered-target
-// RUN: not %clang_cc1 -triple powerpc-unknown-aix \
-// RUN:   -emit-llvm -o - %s 2>&1 | FileCheck %s
-// RUN: not %clang_cc1 -triple powerpc64-unknown-aix \
-// RUN:   -emit-llvm -o - %s 2>&1 | FileCheck %s
-
-// CHECK: fatal error: error in backend: complex type is not supported on AIX 
yet
-_Complex float foo_float(_Complex float x) {
-  return x;
-}

diff  --git a/clang/test/CodeGen/powerpc-c99complex.c 
b/clang/test/CodeGen/powerpc-c99complex.c
index 95c71ee4ec81..a59cdb683c0e 100644
--- a/clang/test/CodeGen/powerpc-c99complex.c
+++ b/clang/test/CodeGen/powerpc-c99complex.c
@@ -1,39 +1,44 @@
-// RUN: %clang_cc1 -triple powerpc64-unknown-linux -emit-llvm %s -o - | 
FileCheck %s --check-prefixes=PPC64LNX
-// RUN: %clang_cc1 -triple ppc64le-unknown-linux -emit-llvm %s -o - | 
FileCheck %s --check-prefixes=PPC64LNX
+// RUN: %clang_cc1 -triple powerpc64-unknown-aix -emit-llvm %s -o - | 
FileCheck %s --check-prefixes=CHECK,CHECK-NOLDBL128
+// RUN: %clang_cc1 -triple powerpc-unknown-aix -emit-llvm %s -o - | FileCheck 
%s --check-prefixes=CHECK,CHECK-NOLDBL128
+// RUN: %clang_cc1 -triple powerpc64-unknown-linux -emit-llvm %s -o - | 
FileCheck %s --check-prefixes=CHECK,CHECK-LDBL128
+// RUN: %clang_cc1 -triple ppc64le-unknown-linux -emit-llvm %s -o - | 
FileCheck %s --check-prefixes=CHECK,CHECK-LDBL128
 // RUN: %clang_cc1 -triple powerpc-unknown-linux -emit-llvm %s -o - | 
FileCheck %s --check-prefix=PPC32LNX
 
 _Complex float foo1(_Complex float x) {
   return x;
-// PPC64LNX-LABEL:   define { float, float } @foo1(float %x.{{.*}}, float 
%x.{{.*}}) #0 {
-// PPC64LNX: ret { float, float }
+// CHECK-LABEL: define { float, float } @foo1(float %x.{{.*}}, 
float %x.{{.*}}) #0 {
+// CHECK:   ret { float, float }
 
-// PPC32LNX-LABEL:   define void @foo1({ float, float }* noalias sret 
align 4 %agg.result, { float, float }* byval({ float, float }) align 4 %x) #0 {
-// PPC32LNX: [[RETREAL:%.*]] = getelementptr inbounds { float, 
float }, { float, float }* %agg.result, i32 0, i32 0
-// PPC32LNX-NEXT:[[RETIMAG:%.*]] = getelementptr inbounds { float, 
float }, { float, float }* %agg.result, i32 0, i32 1
-// PPC32LNX-NEXT:store float %{{.*}}, float* [[RETREAL]], align 4
-// PPC32LNX-NEXT:store float %{{.*}}, float* [[RETIMAG]], align 4
+// PPC32LNX-LABEL:  define void @foo1({ float, float }* noalias sret 
align 4 %agg.result, { float, float }* byval({ float, float }) align 4 %x) #0 {
+// 

[clang] 64b8a63 - [NFC] [PPC] Add PowerPC expected IR tests for C99 complex

2020-09-24 Thread Zarko Todorovski via cfe-commits

Author: Chris Bowler
Date: 2020-09-24T23:28:40-04:00
New Revision: 64b8a633a872f25c8b3f9414c22165405400ea10

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

LOG: [NFC] [PPC] Add PowerPC expected IR tests for C99 complex

Adding this test so that I can extend it in a follow on patch with
expected IR for AIX when I implement complex handling in
AIXABIInfo.

Reviewed By: daltenty, ZarkoCA

Differential Revision: https://reviews.llvm.org/D88105

Added: 
clang/test/CodeGen/powerpc-c99complex.c

Modified: 


Removed: 




diff  --git a/clang/test/CodeGen/powerpc-c99complex.c 
b/clang/test/CodeGen/powerpc-c99complex.c
new file mode 100644
index ..95c71ee4ec81
--- /dev/null
+++ b/clang/test/CodeGen/powerpc-c99complex.c
@@ -0,0 +1,39 @@
+// RUN: %clang_cc1 -triple powerpc64-unknown-linux -emit-llvm %s -o - | 
FileCheck %s --check-prefixes=PPC64LNX
+// RUN: %clang_cc1 -triple ppc64le-unknown-linux -emit-llvm %s -o - | 
FileCheck %s --check-prefixes=PPC64LNX
+// RUN: %clang_cc1 -triple powerpc-unknown-linux -emit-llvm %s -o - | 
FileCheck %s --check-prefix=PPC32LNX
+
+_Complex float foo1(_Complex float x) {
+  return x;
+// PPC64LNX-LABEL:   define { float, float } @foo1(float %x.{{.*}}, float 
%x.{{.*}}) #0 {
+// PPC64LNX: ret { float, float }
+
+// PPC32LNX-LABEL:   define void @foo1({ float, float }* noalias sret 
align 4 %agg.result, { float, float }* byval({ float, float }) align 4 %x) #0 {
+// PPC32LNX: [[RETREAL:%.*]] = getelementptr inbounds { float, 
float }, { float, float }* %agg.result, i32 0, i32 0
+// PPC32LNX-NEXT:[[RETIMAG:%.*]] = getelementptr inbounds { float, 
float }, { float, float }* %agg.result, i32 0, i32 1
+// PPC32LNX-NEXT:store float %{{.*}}, float* [[RETREAL]], align 4
+// PPC32LNX-NEXT:store float %{{.*}}, float* [[RETIMAG]], align 4
+}
+
+_Complex double foo2(_Complex double x) {
+  return x;
+// PPC64LNX-LABEL:   define { double, double } @foo2(double %x.{{.*}}, 
double %x.{{.*}}) #0 {
+// PPC64LNX: ret { double, double }
+
+// PPC32LNX-LABEL:   define void @foo2({ double, double }* noalias sret 
align 8 %agg.result, { double, double }* byval({ double, double }) align 8 %x) 
#0 {
+// PPC32LNX: [[RETREAL:%.*]] = getelementptr inbounds { double, 
double }, { double, double }* %agg.result, i32 0, i32 0
+// PPC32LNX-NEXT:[[RETIMAG:%.*]] = getelementptr inbounds { double, 
double }, { double, double }* %agg.result, i32 0, i32 1
+// PPC32LNX-NEXT:store double %{{.*}}, double* [[RETREAL]], align 8
+// PPC32LNX-NEXT:store double %{{.*}}, double* [[RETIMAG]], align 8
+}
+
+_Complex long double foo3(_Complex long double x) {
+  return x;
+// PPC64LNX-LABEL:  define { ppc_fp128, ppc_fp128 } @foo3(ppc_fp128 
%x.{{.*}}, ppc_fp128 %x.{{.*}}) #0 {
+// PPC64LNX:ret { ppc_fp128, ppc_fp128 }
+
+// PPC32LNX-LABEL:  define void @foo3({ ppc_fp128, ppc_fp128 }* noalias 
sret align 16 %agg.result, { ppc_fp128, ppc_fp128 }* byval({ ppc_fp128, 
ppc_fp128 }) align 16 %x) #0 {
+// PPC32LNX:[[RETREAL:%.*]] = getelementptr inbounds { ppc_fp128, 
ppc_fp128 }, { ppc_fp128, ppc_fp128 }* %agg.result, i32 0, i32 0
+// PPC32LNX-NEXT:   [[RETIMAG:%.*]] = getelementptr inbounds { ppc_fp128, 
ppc_fp128 }, { ppc_fp128, ppc_fp128 }* %agg.result, i32 0, i32 1
+// PPC32LNX-NEXT:   store ppc_fp128 %{{.*}}, ppc_fp128* [[RETREAL]], align 
16
+// PPC32LNX-NEXT:   store ppc_fp128 %{{.*}}, ppc_fp128* [[RETIMAG]], align 
16
+}



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits