forked from OSchip/llvm-project
[AST] Replace asserts with a condition
As was done for other locations in commit 54272e5b
(NFC:
Replace asserts with if() in SourceLocation accessors, 2019-01-07).
Extracted from https://reviews.llvm.org/D99231
This commit is contained in:
parent
cc88d301a0
commit
6559ebd91b
clang/include/clang/AST
|
@ -2267,7 +2267,8 @@ public:
|
||||||
|
|
||||||
// For a pack expansion, returns the location of the ellipsis.
|
// For a pack expansion, returns the location of the ellipsis.
|
||||||
SourceLocation getEllipsisLoc() const {
|
SourceLocation getEllipsisLoc() const {
|
||||||
assert(isPackExpansion() && "Initializer is not a pack expansion");
|
if (!isPackExpansion())
|
||||||
|
return {};
|
||||||
return MemberOrEllipsisLocation;
|
return MemberOrEllipsisLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -512,7 +512,8 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
TypeSourceInfo *getTypeSourceInfo() const {
|
TypeSourceInfo *getTypeSourceInfo() const {
|
||||||
assert(Argument.getKind() == TemplateArgument::Type);
|
if (Argument.getKind() != TemplateArgument::Type)
|
||||||
|
return nullptr;
|
||||||
return LocInfo.getAsTypeSourceInfo();
|
return LocInfo.getAsTypeSourceInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue