Skip to content

Commit 2d3de7a

Browse files
Shrink database file header
Created using spr 1.3.7
2 parents f0b58bc + 95386cc commit 2d3de7a

File tree

143 files changed

+51356
-45219
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

143 files changed

+51356
-45219
lines changed

clang-tools-extra/clang-tidy/bugprone/ThrowKeywordMissingCheck.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ void ThrowKeywordMissingCheck::registerMatchers(MatchFinder *Finder) {
2020
hasType(cxxRecordDecl(anyOf(
2121
matchesName("[Ee]xception|EXCEPTION"),
2222
hasAnyBase(hasType(hasCanonicalType(recordType(hasDeclaration(
23-
cxxRecordDecl(matchesName("[Ee]xception|EXCEPTION")))))))))),
23+
cxxRecordDecl(matchesName("[Ee]xception|EXCEPTION"))
24+
.bind("base"))))))))),
2425
unless(anyOf(
2526
hasAncestor(
2627
stmt(anyOf(cxxThrowExpr(), callExpr(), returnStmt()))),
@@ -39,6 +40,11 @@ void ThrowKeywordMissingCheck::check(const MatchFinder::MatchResult &Result) {
3940
diag(TemporaryExpr->getBeginLoc(), "suspicious exception object created but "
4041
"not thrown; did you mean 'throw %0'?")
4142
<< TemporaryExpr->getType().getBaseTypeIdentifier()->getName();
43+
44+
if (const auto *BaseDecl = Result.Nodes.getNodeAs<Decl>("base"))
45+
diag(BaseDecl->getLocation(),
46+
"object type inherits from base class declared here",
47+
DiagnosticIDs::Note);
4248
}
4349

4450
} // namespace clang::tidy::bugprone

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,8 @@ Changes in existing checks
272272

273273
- Improved :doc:`bugprone-throw-keyword-missing
274274
<clang-tidy/checks/bugprone/throw-keyword-missing>` check by only considering
275-
the canonical types of base classes as written.
275+
the canonical types of base classes as written and adding a note on the base
276+
class that triggered the warning.
276277

277278
- Improved :doc:`bugprone-unchecked-optional-access
278279
<clang-tidy/checks/bugprone/unchecked-optional-access>` check by supporting

clang-tools-extra/docs/clang-tidy/Contributing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ in the release notes, as the first sentence in the doxygen comments in the heade
436436
for your check class and as the first sentence of the check documentation. Avoid the
437437
phrase "this check" in your check summary and check documentation.
438438

439-
If your check relates to a published coding guideline (C++ Core Guidelines, MISRA, etc.)
439+
If your check relates to a published coding guideline (C++ Core Guidelines, SEI CERT, etc.)
440440
or style guide, provide links to the relevant guideline or style guide sections in your
441441
check documentation.
442442

clang-tools-extra/test/clang-tidy/checkers/bugprone/throw-keyword-missing.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ typedef basic_string<char> string;
2020
typedef basic_string<wchar_t> wstring;
2121

2222
// std::exception and std::runtime_error declaration.
23+
// CHECK-MESSAGES-DAG: [[#EXCEPTION_LINE:@LINE + 1]]:8
2324
struct exception {
2425
exception();
2526
exception(const exception &other);
@@ -50,12 +51,13 @@ struct RegularException {
5051

5152
void stdExceptionNotTrownTest(int i) {
5253
if (i < 0)
53-
// CHECK-MESSAGES: :[[@LINE+1]]:5: warning: suspicious exception object created but not thrown; did you mean 'throw {{.*}}'? [bugprone-throw-keyword-missing]
54+
// CHECK-MESSAGES-DAG: :[[@LINE+1]]:5: warning: suspicious exception object created but not thrown; did you mean 'throw {{.*}}'? [bugprone-throw-keyword-missing]
5455
std::exception();
5556

5657
if (i > 0)
57-
// CHECK-MESSAGES: :[[@LINE+1]]:5: warning: suspicious exception
58+
// CHECK-MESSAGES-DAG: :[[@LINE+1]]:5: warning: suspicious exception
5859
std::runtime_error("Unexpected argument");
60+
// CHECK-MESSAGES: note: object type inherits from base class declared here
5961
}
6062

6163
void stdExceptionThrownTest(int i) {
@@ -181,6 +183,7 @@ class RegularError : public ERROR_BASE {};
181183
void typedefTest() {
182184
// CHECK-MESSAGES: :[[@LINE+1]]:3: warning: suspicious exception
183185
RegularError();
186+
// CHECK-MESSAGES: :[[#EXCEPTION_LINE]]:8: note: object type inherits from base class declared here
184187
}
185188

186189
struct ExceptionRAII {

clang/include/clang/Basic/DiagnosticCommonKinds.td

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,12 @@ def err_omp_more_one_clause : Error<
433433
"directive '#pragma omp %0' cannot contain more than one '%1' clause%select{| with '%3' name modifier| with 'source' dependence}2">;
434434
def err_omp_required_clause : Error<
435435
"directive '#pragma omp %0' requires the '%1' clause">;
436+
def warn_omp_gpu_unsupported_clause: Warning<
437+
"clause '%0' is currently not supported on a GPU; clause ignored">,
438+
InGroup<OpenMPClauses>;
439+
def warn_omp_gpu_unsupported_modifier_for_clause: Warning<
440+
"modifier '%0' is currently not supported on a GPU for the '%1' clause; modifier ignored">,
441+
InGroup<OpenMPClauses>;
436442

437443
// Static Analyzer Core
438444
def err_unknown_analyzer_checker_or_package : Error<

clang/include/clang/CodeGen/BackendUtil.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ void EmbedBitcode(llvm::Module *M, const CodeGenOptions &CGOpts,
4949
llvm::MemoryBufferRef Buf);
5050

5151
void EmbedObject(llvm::Module *M, const CodeGenOptions &CGOpts,
52-
DiagnosticsEngine &Diags);
52+
llvm::vfs::FileSystem &VFS, DiagnosticsEngine &Diags);
5353
} // namespace clang
5454

5555
#endif

clang/lib/CodeGen/BackendUtil.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1476,13 +1476,13 @@ void clang::EmbedBitcode(llvm::Module *M, const CodeGenOptions &CGOpts,
14761476
}
14771477

14781478
void clang::EmbedObject(llvm::Module *M, const CodeGenOptions &CGOpts,
1479-
DiagnosticsEngine &Diags) {
1479+
llvm::vfs::FileSystem &VFS, DiagnosticsEngine &Diags) {
14801480
if (CGOpts.OffloadObjects.empty())
14811481
return;
14821482

14831483
for (StringRef OffloadObject : CGOpts.OffloadObjects) {
14841484
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> ObjectOrErr =
1485-
llvm::MemoryBuffer::getFileOrSTDIN(OffloadObject);
1485+
VFS.getBufferForFile(OffloadObject);
14861486
if (ObjectOrErr.getError()) {
14871487
auto DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Error,
14881488
"could not open '%0' for embedding");

clang/lib/CodeGen/CGDebugInfo.cpp

Lines changed: 24 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#include "clang/AST/DeclObjC.h"
2727
#include "clang/AST/DeclTemplate.h"
2828
#include "clang/AST/Expr.h"
29-
#include "clang/AST/LambdaCapture.h"
3029
#include "clang/AST/RecordLayout.h"
3130
#include "clang/AST/RecursiveASTVisitor.h"
3231
#include "clang/AST/VTableBuilder.h"
@@ -1904,59 +1903,46 @@ CGDebugInfo::createInlinedSubprogram(StringRef FuncName,
19041903
return SP;
19051904
}
19061905

1907-
llvm::StringRef
1908-
CGDebugInfo::GetLambdaCaptureName(const LambdaCapture &Capture) {
1909-
if (Capture.capturesThis())
1910-
return CGM.getCodeGenOpts().EmitCodeView ? "__this" : "this";
1911-
1912-
assert(Capture.capturesVariable());
1913-
1914-
const ValueDecl *CaptureDecl = Capture.getCapturedVar();
1915-
assert(CaptureDecl && "Expected valid decl for captured variable.");
1916-
1917-
return CaptureDecl->getName();
1918-
}
1919-
19201906
void CGDebugInfo::CollectRecordLambdaFields(
19211907
const CXXRecordDecl *CXXDecl, SmallVectorImpl<llvm::Metadata *> &elements,
19221908
llvm::DIType *RecordTy) {
19231909
// For C++11 Lambdas a Field will be the same as a Capture, but the Capture
19241910
// has the name and the location of the variable so we should iterate over
19251911
// both concurrently.
1912+
const ASTRecordLayout &layout = CGM.getContext().getASTRecordLayout(CXXDecl);
19261913
RecordDecl::field_iterator Field = CXXDecl->field_begin();
19271914
unsigned fieldno = 0;
19281915
for (CXXRecordDecl::capture_const_iterator I = CXXDecl->captures_begin(),
19291916
E = CXXDecl->captures_end();
19301917
I != E; ++I, ++Field, ++fieldno) {
1931-
const LambdaCapture &Capture = *I;
1932-
const uint64_t FieldOffset =
1933-
CGM.getContext().getASTRecordLayout(CXXDecl).getFieldOffset(fieldno);
1934-
1935-
assert(!Field->isBitField() && "lambdas don't have bitfield members!");
1936-
1937-
SourceLocation Loc;
1938-
uint32_t Align = 0;
1939-
1940-
if (Capture.capturesThis()) {
1918+
const LambdaCapture &C = *I;
1919+
if (C.capturesVariable()) {
1920+
SourceLocation Loc = C.getLocation();
1921+
assert(!Field->isBitField() && "lambdas don't have bitfield members!");
1922+
ValueDecl *V = C.getCapturedVar();
1923+
StringRef VName = V->getName();
1924+
llvm::DIFile *VUnit = getOrCreateFile(Loc);
1925+
auto Align = getDeclAlignIfRequired(V, CGM.getContext());
1926+
llvm::DIType *FieldType = createFieldType(
1927+
VName, Field->getType(), Loc, Field->getAccess(),
1928+
layout.getFieldOffset(fieldno), Align, VUnit, RecordTy, CXXDecl);
1929+
elements.push_back(FieldType);
1930+
} else if (C.capturesThis()) {
19411931
// TODO: Need to handle 'this' in some way by probably renaming the
19421932
// this of the lambda class and having a field member of 'this' or
19431933
// by using AT_object_pointer for the function and having that be
19441934
// used as 'this' for semantic references.
1945-
Loc = Field->getLocation();
1946-
} else {
1947-
Loc = Capture.getLocation();
1948-
1949-
const ValueDecl *CaptureDecl = Capture.getCapturedVar();
1950-
assert(CaptureDecl && "Expected valid decl for captured variable.");
1951-
1952-
Align = getDeclAlignIfRequired(CaptureDecl, CGM.getContext());
1935+
FieldDecl *f = *Field;
1936+
llvm::DIFile *VUnit = getOrCreateFile(f->getLocation());
1937+
QualType type = f->getType();
1938+
StringRef ThisName =
1939+
CGM.getCodeGenOpts().EmitCodeView ? "__this" : "this";
1940+
llvm::DIType *fieldType = createFieldType(
1941+
ThisName, type, f->getLocation(), f->getAccess(),
1942+
layout.getFieldOffset(fieldno), VUnit, RecordTy, CXXDecl);
1943+
1944+
elements.push_back(fieldType);
19531945
}
1954-
1955-
llvm::DIFile *VUnit = getOrCreateFile(Loc);
1956-
1957-
elements.push_back(createFieldType(
1958-
GetLambdaCaptureName(Capture), Field->getType(), Loc,
1959-
Field->getAccess(), FieldOffset, Align, VUnit, RecordTy, CXXDecl));
19601946
}
19611947
}
19621948

clang/lib/CodeGen/CGDebugInfo.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,6 @@ class CGDebugInfo {
397397
void CollectRecordFields(const RecordDecl *Decl, llvm::DIFile *F,
398398
SmallVectorImpl<llvm::Metadata *> &E,
399399
llvm::DICompositeType *RecordTy);
400-
llvm::StringRef GetLambdaCaptureName(const LambdaCapture &Capture);
401400

402401
/// If the C++ class has vtable info then insert appropriate debug
403402
/// info entry in EltTys vector.

clang/lib/CodeGen/CGOpenMPRuntime.cpp

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1550,7 +1550,8 @@ static llvm::TargetRegionEntryInfo getEntryInfoFromPresumedLoc(
15501550
return std::pair<std::string, uint64_t>(PLoc.getFilename(), PLoc.getLine());
15511551
};
15521552

1553-
return OMPBuilder.getTargetEntryUniqueInfo(FileInfoCallBack, ParentName);
1553+
return OMPBuilder.getTargetEntryUniqueInfo(FileInfoCallBack,
1554+
*CGM.getFileSystem(), ParentName);
15541555
}
15551556

15561557
ConstantAddress CGOpenMPRuntime::getAddrOfDeclareTargetVar(const VarDecl *VD) {
@@ -2703,7 +2704,8 @@ llvm::Value *CGOpenMPRuntime::emitForNext(CodeGenFunction &CGF,
27032704
}
27042705

27052706
llvm::Value *CGOpenMPRuntime::emitMessageClause(CodeGenFunction &CGF,
2706-
const Expr *Message) {
2707+
const Expr *Message,
2708+
SourceLocation Loc) {
27072709
if (!Message)
27082710
return llvm::ConstantPointerNull::get(CGF.VoidPtrTy);
27092711
return CGF.EmitScalarExpr(Message);
@@ -2713,11 +2715,13 @@ llvm::Value *
27132715
CGOpenMPRuntime::emitMessageClause(CodeGenFunction &CGF,
27142716
const OMPMessageClause *MessageClause) {
27152717
return emitMessageClause(
2716-
CGF, MessageClause ? MessageClause->getMessageString() : nullptr);
2718+
CGF, MessageClause ? MessageClause->getMessageString() : nullptr,
2719+
MessageClause->getBeginLoc());
27172720
}
27182721

27192722
llvm::Value *
2720-
CGOpenMPRuntime::emitSeverityClause(OpenMPSeverityClauseKind Severity) {
2723+
CGOpenMPRuntime::emitSeverityClause(OpenMPSeverityClauseKind Severity,
2724+
SourceLocation Loc) {
27212725
// OpenMP 6.0, 10.4: "If no severity clause is specified then the effect is
27222726
// as if sev-level is fatal."
27232727
return llvm::ConstantInt::get(CGM.Int32Ty,
@@ -2727,13 +2731,15 @@ CGOpenMPRuntime::emitSeverityClause(OpenMPSeverityClauseKind Severity) {
27272731
llvm::Value *
27282732
CGOpenMPRuntime::emitSeverityClause(const OMPSeverityClause *SeverityClause) {
27292733
return emitSeverityClause(SeverityClause ? SeverityClause->getSeverityKind()
2730-
: OMPC_SEVERITY_unknown);
2734+
: OMPC_SEVERITY_unknown,
2735+
SeverityClause->getBeginLoc());
27312736
}
27322737

27332738
void CGOpenMPRuntime::emitNumThreadsClause(
27342739
CodeGenFunction &CGF, llvm::Value *NumThreads, SourceLocation Loc,
27352740
OpenMPNumThreadsClauseModifier Modifier, OpenMPSeverityClauseKind Severity,
2736-
const Expr *Message) {
2741+
SourceLocation SeverityLoc, const Expr *Message,
2742+
SourceLocation MessageLoc) {
27372743
if (!CGF.HaveInsertPoint())
27382744
return;
27392745
llvm::SmallVector<llvm::Value *, 4> Args(
@@ -2745,8 +2751,8 @@ void CGOpenMPRuntime::emitNumThreadsClause(
27452751
RuntimeFunction FnID = OMPRTL___kmpc_push_num_threads;
27462752
if (Modifier == OMPC_NUMTHREADS_strict) {
27472753
FnID = OMPRTL___kmpc_push_num_threads_strict;
2748-
Args.push_back(emitSeverityClause(Severity));
2749-
Args.push_back(emitMessageClause(CGF, Message));
2754+
Args.push_back(emitSeverityClause(Severity, SeverityLoc));
2755+
Args.push_back(emitMessageClause(CGF, Message, MessageLoc));
27502756
}
27512757
CGF.EmitRuntimeCall(
27522758
OMPBuilder.getOrCreateRuntimeFunction(CGM.getModule(), FnID), Args);
@@ -12654,7 +12660,8 @@ llvm::Value *CGOpenMPSIMDRuntime::emitForNext(CodeGenFunction &CGF,
1265412660
void CGOpenMPSIMDRuntime::emitNumThreadsClause(
1265512661
CodeGenFunction &CGF, llvm::Value *NumThreads, SourceLocation Loc,
1265612662
OpenMPNumThreadsClauseModifier Modifier, OpenMPSeverityClauseKind Severity,
12657-
const Expr *Message) {
12663+
SourceLocation SeverityLoc, const Expr *Message,
12664+
SourceLocation MessageLoc) {
1265812665
llvm_unreachable("Not supported in SIMD-only mode");
1265912666
}
1266012667

0 commit comments

Comments
 (0)