summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/AST/ASTContext.cpp3
-rw-r--r--lib/CodeGen/CodeGenFunction.cpp3
-rw-r--r--lib/Index/IndexDecl.cpp8
-rw-r--r--lib/Sema/SemaInit.cpp2
4 files changed, 11 insertions, 5 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index d03c22af5b29..b531a66dbab3 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -9025,7 +9025,8 @@ bool ASTContext::DeclMustBeEmitted(const Decl *D) {
// Variables that have initialization with side-effects are required.
if (VD->getInit() && VD->getInit()->HasSideEffects(*this) &&
- !VD->evaluateValue())
+ // We can get a value-dependent initializer during error recovery.
+ (VD->getInit()->isValueDependent() || !VD->evaluateValue()))
return true;
// Likewise, variables with tuple-like bindings are required if their
diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp
index 137c69420ddf..e142a21b1e74 100644
--- a/lib/CodeGen/CodeGenFunction.cpp
+++ b/lib/CodeGen/CodeGenFunction.cpp
@@ -112,9 +112,8 @@ CodeGenFunction::~CodeGenFunction() {
if (FirstBlockInfo)
destroyBlockInfos(FirstBlockInfo);
- if (getLangOpts().OpenMP) {
+ if (getLangOpts().OpenMP && CurFn)
CGM.getOpenMPRuntime().functionFinished(*this);
- }
}
CharUnits CodeGenFunction::getNaturalPointeeTypeAlignment(QualType T,
diff --git a/lib/Index/IndexDecl.cpp b/lib/Index/IndexDecl.cpp
index 7d60aad3895d..3b4f3f81399d 100644
--- a/lib/Index/IndexDecl.cpp
+++ b/lib/Index/IndexDecl.cpp
@@ -92,7 +92,13 @@ public:
Relations.emplace_back((unsigned)SymbolRole::RelationAccessorOf,
AssociatedProp);
- if (!IndexCtx.handleDecl(D, (unsigned)SymbolRole::Dynamic, Relations))
+ // getLocation() returns beginning token of a method declaration, but for
+ // indexing purposes we want to point to the base name.
+ SourceLocation MethodLoc = D->getSelectorStartLoc();
+ if (MethodLoc.isInvalid())
+ MethodLoc = D->getLocation();
+
+ if (!IndexCtx.handleDecl(D, MethodLoc, (unsigned)SymbolRole::Dynamic, Relations))
return false;
IndexCtx.indexTypeSourceInfo(D->getReturnTypeSourceInfo(), D);
bool hasIBActionAndFirst = D->hasAttr<IBActionAttr>();
diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp
index 45eff5ee6b62..b053c83c3f69 100644
--- a/lib/Sema/SemaInit.cpp
+++ b/lib/Sema/SemaInit.cpp
@@ -1684,7 +1684,7 @@ void InitListChecker::CheckArrayType(const InitializedEntity &Entity,
// If this is an incomplete array type, the actual type needs to
// be calculated here.
llvm::APSInt Zero(maxElements.getBitWidth(), maxElements.isUnsigned());
- if (maxElements == Zero) {
+ if (maxElements == Zero && !Entity.isVariableLengthArrayNew()) {
// Sizing an array implicitly to zero is not allowed by ISO C,
// but is supported by GNU.
SemaRef.Diag(IList->getLocStart(),