Bug 1501821 - Update clang-plugin in order to make it compatiable with clang 8.0.0 trunk. r=froydnj
authorAndi-Bogdan Postelnicu <bpostelnicu@mozilla.com>
Sat, 03 Nov 2018 13:41:36 +0000
changeset 487444 538a16d495142178a73e0bdc30f100b43d2fd62b
parent 487443 44dc7d4993ec12415622b446294f59e57d425be6
child 487445 15da260eaa3cb3e9e3951114de8f4c82a8435275
push idunknown
push userunknown
push dateunknown
reviewersfroydnj
bugs1501821
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1501821 - Update clang-plugin in order to make it compatiable with clang 8.0.0 trunk. r=froydnj Differential Revision: https://phabricator.services.mozilla.com/D10806
build/clang-plugin/ArithmeticArgChecker.cpp
build/clang-plugin/AssertAssignmentChecker.cpp
build/clang-plugin/CustomAttributes.cpp
build/clang-plugin/DanglingOnTemporaryChecker.cpp
build/clang-plugin/ExplicitOperatorBoolChecker.cpp
build/clang-plugin/KungFuDeathGripChecker.cpp
build/clang-plugin/MustReturnFromCallerChecker.cpp
build/clang-plugin/MustUseChecker.cpp
build/clang-plugin/NaNExprChecker.cpp
build/clang-plugin/NeedsNoVTableTypeChecker.cpp
build/clang-plugin/NoAddRefReleaseOnReturnChecker.cpp
build/clang-plugin/NoDuplicateRefCntMemberChecker.cpp
build/clang-plugin/ParamTraitsEnumChecker.cpp
build/clang-plugin/RefCountedInsideLambdaChecker.cpp
build/clang-plugin/ScopeChecker.cpp
build/clang-plugin/SprintfLiteralChecker.cpp
build/clang-plugin/TrivialCtorDtorChecker.cpp
build/clang-plugin/Utils.h
build/clang-plugin/mozsearch-plugin/MozsearchIndexer.cpp
build/clang-plugin/plugin.h
--- a/build/clang-plugin/ArithmeticArgChecker.cpp
+++ b/build/clang-plugin/ArithmeticArgChecker.cpp
@@ -45,16 +45,16 @@ void ArithmeticArgChecker::registerMatch
       this);
 }
 
 void ArithmeticArgChecker::check(const MatchFinder::MatchResult &Result) {
   const char *Error =
       "cannot pass an arithmetic expression of built-in types to %0";
   const Expr *Expression = Result.Nodes.getNodeAs<Expr>("node");
   if (const CallExpr *Call = Result.Nodes.getNodeAs<CallExpr>("call")) {
-    diag(Expression->getLocStart(), Error, DiagnosticIDs::Error)
+    diag(Expression->getBeginLoc(), Error, DiagnosticIDs::Error)
         << Call->getDirectCallee();
   } else if (const CXXConstructExpr *Ctr =
                  Result.Nodes.getNodeAs<CXXConstructExpr>("call")) {
-    diag(Expression->getLocStart(), Error, DiagnosticIDs::Error)
+    diag(Expression->getBeginLoc(), Error, DiagnosticIDs::Error)
         << Ctr->getConstructor();
   }
 }
--- a/build/clang-plugin/AssertAssignmentChecker.cpp
+++ b/build/clang-plugin/AssertAssignmentChecker.cpp
@@ -9,12 +9,12 @@ void AssertAssignmentChecker::registerMa
   AstMatcher->addMatcher(
       callExpr(isAssertAssignmentTestFunc()).bind("funcCall"), this);
 }
 
 void AssertAssignmentChecker::check(const MatchFinder::MatchResult &Result) {
   const CallExpr *FuncCall = Result.Nodes.getNodeAs<CallExpr>("funcCall");
 
   if (FuncCall && hasSideEffectAssignment(FuncCall)) {
-    diag(FuncCall->getLocStart(), "Forbidden assignment in assert expression",
+    diag(FuncCall->getBeginLoc(), "Forbidden assignment in assert expression",
          DiagnosticIDs::Error);
   }
 }
--- a/build/clang-plugin/CustomAttributes.cpp
+++ b/build/clang-plugin/CustomAttributes.cpp
@@ -47,17 +47,17 @@ static CustomAttributesSet CacheAttribut
 }
 
 static void Report(const Decl* D, const char* message)
 {
   ASTContext& Context = D->getASTContext();
   DiagnosticsEngine& Diag = Context.getDiagnostics();
   unsigned ID = Diag.getDiagnosticIDs()->getCustomDiagID(
     DiagnosticIDs::Warning, message);
-  Diag.Report(D->getLocStart(), ID);
+  Diag.Report(D->getBeginLoc(), ID);
 }
 
 CustomAttributesSet GetAttributes(const Decl* D)
 {
   CustomAttributesSet attrs = {};
   if (D->hasAttr<AnnotateAttr>()) {
     Report(D, "Declaration has unhandled annotations.");
     attrs = CacheAttributes(D);
--- a/build/clang-plugin/DanglingOnTemporaryChecker.cpp
+++ b/build/clang-plugin/DanglingOnTemporaryChecker.cpp
@@ -215,17 +215,17 @@ void DanglingOnTemporaryChecker::check(c
 
     // We emit the error diagnostic indicating that we are calling the method
     // temporary.
     diag(MemberCall->getExprLoc(), Error, DiagnosticIDs::Error)
         << MemberCall->getMethodDecl()->getName()
         << MemberCall->getSourceRange();
 
     // We indicate the escape statement.
-    diag(EscapeStmt->getLocStart(), EscapeStmtNote, DiagnosticIDs::Note)
+    diag(EscapeStmt->getBeginLoc(), EscapeStmtNote, DiagnosticIDs::Note)
         << EscapeStmt->getSourceRange();
 
     // We build the escape note along with its source range.
     StringRef EscapeDeclNote;
     SourceRange EscapeDeclRange;
     if (isa<ParmVarDecl>(EscapeDecl)) {
       EscapeDeclNote = "through the parameter declared here";
       EscapeDeclRange = EscapeDecl->getSourceRange();
--- a/build/clang-plugin/ExplicitOperatorBoolChecker.cpp
+++ b/build/clang-plugin/ExplicitOperatorBoolChecker.cpp
@@ -20,16 +20,16 @@ void ExplicitOperatorBoolChecker::check(
   const CXXConversionDecl *Method =
       Result.Nodes.getNodeAs<CXXConversionDecl>("node");
   const CXXRecordDecl *Clazz = Method->getParent();
 
   if (!Method->isExplicitSpecified() &&
       !hasCustomAttribute<moz_implicit>(Method) &&
       !ASTIsInSystemHeader(Method->getASTContext(), *Method) &&
       isInterestingDeclForImplicitConversion(Method)) {
-    diag(Method->getLocStart(), "bad implicit conversion operator for %0",
+    diag(Method->getBeginLoc(), "bad implicit conversion operator for %0",
          DiagnosticIDs::Error)
         << Clazz;
-    diag(Method->getLocStart(), "consider adding the explicit keyword to %0",
+    diag(Method->getBeginLoc(), "consider adding the explicit keyword to %0",
          DiagnosticIDs::Note)
         << "'operator bool'";
   }
 }
--- a/build/clang-plugin/KungFuDeathGripChecker.cpp
+++ b/build/clang-plugin/KungFuDeathGripChecker.cpp
@@ -87,13 +87,13 @@ void KungFuDeathGripChecker::check(const
     ErrThing = "members";
     NoteThing = "member";
   } else {
     ErrThing = "temporary values";
     NoteThing = "value";
   }
 
   // We cannot provide the note if we don't have an initializer
-  diag(D->getLocStart(), Error, DiagnosticIDs::Error)
+  diag(D->getBeginLoc(), Error, DiagnosticIDs::Error)
       << D->getType() << ErrThing;
-  diag(E->getLocStart(), Note, DiagnosticIDs::Note)
+  diag(E->getBeginLoc(), Note, DiagnosticIDs::Note)
       << NoteThing << getNameChecked(D);
 }
--- a/build/clang-plugin/MustReturnFromCallerChecker.cpp
+++ b/build/clang-plugin/MustReturnFromCallerChecker.cpp
@@ -43,17 +43,17 @@ void MustReturnFromCallerChecker::check(
 
   // Determine which block in the CFG we want to look at the successors of.
   StmtToBlockMap BlockMap(TheCFG.get(), Result.Context);
   size_t CallIndex;
   const auto *Block = BlockMap.blockContainingStmt(Call, &CallIndex);
   assert(Block && "This statement should be within the CFG!");
 
   if (!immediatelyReturns(Block, Result.Context, CallIndex + 1)) {
-    diag(Call->getLocStart(),
+    diag(Call->getBeginLoc(),
          "You must immediately return after calling this function",
          DiagnosticIDs::Error);
   }
 }
 
 bool MustReturnFromCallerChecker::immediatelyReturns(
     RecurseGuard<const CFGBlock *> Block, ASTContext *TheContext,
     size_t FromIdx) {
--- a/build/clang-plugin/MustUseChecker.cpp
+++ b/build/clang-plugin/MustUseChecker.cpp
@@ -50,15 +50,15 @@ void MustUseChecker::check(const MatchFi
 }
 
 void MustUseChecker::handleUnusedExprResult(const Stmt *Statement) {
   const Expr *E = dyn_cast_or_null<Expr>(Statement);
   if (E) {
     E = E->IgnoreImplicit(); // Ignore ExprWithCleanup etc. implicit wrappers
     QualType T = E->getType();
     if (MustUse.hasEffectiveAnnotation(T) && !isIgnoredExprForMustUse(E)) {
-      diag(E->getLocStart(), "Unused value of must-use type %0",
+      diag(E->getBeginLoc(), "Unused value of must-use type %0",
            DiagnosticIDs::Error)
           << T;
-      MustUse.dumpAnnotationReason(*this, T, E->getLocStart());
+      MustUse.dumpAnnotationReason(*this, T, E->getBeginLoc());
     }
   }
 }
--- a/build/clang-plugin/NaNExprChecker.cpp
+++ b/build/clang-plugin/NaNExprChecker.cpp
@@ -41,16 +41,16 @@ void NaNExprChecker::check(const MatchFi
   //    |-DeclRefExpr
   // The check below ensures that we are dealing with the correct AST subtree
   // shape, and
   // also that both of the found DeclRefExpr's point to the same declaration.
   if (LHS->getFoundDecl() == RHS->getFoundDecl() && LHSExpr && RHSExpr &&
       std::distance(LHSExpr->child_begin(), LHSExpr->child_end()) == 1 &&
       std::distance(RHSExpr->child_begin(), RHSExpr->child_end()) == 1 &&
       *LHSExpr->child_begin() == LHS && *RHSExpr->child_begin() == RHS) {
-    diag(Expression->getLocStart(),
+    diag(Expression->getBeginLoc(),
          "comparing a floating point value to itself for "
          "NaN checking can lead to incorrect results",
          DiagnosticIDs::Error);
-    diag(Expression->getLocStart(), "consider using mozilla::IsNaN instead",
+    diag(Expression->getBeginLoc(), "consider using mozilla::IsNaN instead",
          DiagnosticIDs::Note);
   }
 }
--- a/build/clang-plugin/NeedsNoVTableTypeChecker.cpp
+++ b/build/clang-plugin/NeedsNoVTableTypeChecker.cpp
@@ -24,16 +24,16 @@ void NeedsNoVTableTypeChecker::check(con
       Specialization->getTemplateInstantiationArgs();
   for (unsigned i = 0; i < Args.size(); ++i) {
     Offender = Args[i].getAsType();
     if (typeHasVTable(Offender)) {
       break;
     }
   }
 
-  diag(Specialization->getLocStart(),
+  diag(Specialization->getBeginLoc(),
        "%0 cannot be instantiated because %1 has a VTable",
        DiagnosticIDs::Error)
       << Specialization << Offender;
   diag(Specialization->getPointOfInstantiation(),
        "bad instantiation of %0 requested here", DiagnosticIDs::Note)
       << Specialization;
 }
--- a/build/clang-plugin/NoAddRefReleaseOnReturnChecker.cpp
+++ b/build/clang-plugin/NoAddRefReleaseOnReturnChecker.cpp
@@ -17,16 +17,16 @@ void NoAddRefReleaseOnReturnChecker::che
   const MemberExpr *Member = Result.Nodes.getNodeAs<MemberExpr>("member");
   const Expr *Base = IgnoreTrivials(Member->getBase());
 
   // Check if the call to AddRef() or Release() was made on the result of a call
   // to a MOZ_NO_ADDREF_RELEASE_ON_RETURN function or method.
   if (auto *Call = dyn_cast<CallExpr>(Base)) {
     if (auto *Callee = Call->getDirectCallee()) {
       if (hasCustomAttribute<moz_no_addref_release_on_return>(Callee)) {
-        diag(Call->getLocStart(),
+        diag(Call->getBeginLoc(),
              "%1 cannot be called on the return value of %0",
              DiagnosticIDs::Error)
             << Callee << dyn_cast<CXXMethodDecl>(Member->getMemberDecl());
       }
     }
   }
 }
--- a/build/clang-plugin/NoDuplicateRefCntMemberChecker.cpp
+++ b/build/clang-plugin/NoDuplicateRefCntMemberChecker.cpp
@@ -34,32 +34,32 @@ void NoDuplicateRefCntMemberChecker::che
     if (BaseRefCntMember) {
       if (RefCntMember) {
         // We have an mRefCnt, and superclass has an mRefCnt
         const char *Error = "Refcounted record %0 has multiple mRefCnt members";
         const char *Note1 = "Superclass %0 also has an mRefCnt member";
         const char *Note2 =
             "Consider using the _INHERITED macros for AddRef and Release here";
 
-        diag(D->getLocStart(), Error, DiagnosticIDs::Error) << D;
-        diag(BaseRefCntMember->getLocStart(), Note1, DiagnosticIDs::Note)
+        diag(D->getBeginLoc(), Error, DiagnosticIDs::Error) << D;
+        diag(BaseRefCntMember->getBeginLoc(), Note1, DiagnosticIDs::Note)
             << BaseRefCntMember->getParent();
-        diag(RefCntMember->getLocStart(), Note2, DiagnosticIDs::Note);
+        diag(RefCntMember->getBeginLoc(), Note2, DiagnosticIDs::Note);
       }
 
       if (FoundRefCntBase) {
         const char *Error = "Refcounted record %0 has multiple superclasses "
                             "with mRefCnt members";
         const char *Note = "Superclass %0 has an mRefCnt member";
 
         // superclass has mRefCnt, and another superclass also has an mRefCnt
-        diag(D->getLocStart(), Error, DiagnosticIDs::Error) << D;
-        diag(BaseRefCntMember->getLocStart(), Note, DiagnosticIDs::Note)
+        diag(D->getBeginLoc(), Error, DiagnosticIDs::Error) << D;
+        diag(BaseRefCntMember->getBeginLoc(), Note, DiagnosticIDs::Note)
             << BaseRefCntMember->getParent();
-        diag(FoundRefCntBase->getLocStart(), Note, DiagnosticIDs::Note)
+        diag(FoundRefCntBase->getBeginLoc(), Note, DiagnosticIDs::Note)
             << FoundRefCntBase->getParent();
       }
 
       // Record that we've found a base with a mRefCnt member
       FoundRefCntBase = BaseRefCntMember;
     }
   }
 }
--- a/build/clang-plugin/ParamTraitsEnumChecker.cpp
+++ b/build/clang-plugin/ParamTraitsEnumChecker.cpp
@@ -20,18 +20,18 @@ void ParamTraitsEnumChecker::check(const
       QualType CanonicalType = UnderlyingType.getCanonicalType();
 
       const clang::Type *TypePtr = CanonicalType.getTypePtrOrNull();
       if (!TypePtr) {
         return;
       }
 
       if (TypePtr->isEnumeralType()) {
-        diag(Decl->getLocStart(),
+        diag(Decl->getBeginLoc(),
              "Custom ParamTraits implementation for an enum type",
              DiagnosticIDs::Error);
-        diag(Decl->getLocStart(),
+        diag(Decl->getBeginLoc(),
              "Please use a helper class for example ContiguousEnumSerializer",
              DiagnosticIDs::Note);
       }
     }
   }
 }
--- a/build/clang-plugin/RefCountedInsideLambdaChecker.cpp
+++ b/build/clang-plugin/RefCountedInsideLambdaChecker.cpp
@@ -139,14 +139,14 @@ void RefCountedInsideLambdaChecker::chec
     }
   }
 }
 
 bool RefCountedInsideLambdaChecker::ThisVisitor::VisitCXXThisExpr(
     CXXThisExpr *This) {
   QualType Pointee = This->getType()->getPointeeType();
   if (!Pointee.isNull() && isClassRefCounted(Pointee)) {
-    Checker.emitDiagnostics(This->getLocStart(), "this", Pointee);
+    Checker.emitDiagnostics(This->getBeginLoc(), "this", Pointee);
     return false;
   }
 
   return true;
 }
--- a/build/clang-plugin/ScopeChecker.cpp
+++ b/build/clang-plugin/ScopeChecker.cpp
@@ -60,25 +60,25 @@ void ScopeChecker::check(const MatchFind
   // Determine the type of allocation which we detected
   if (const VarDecl *D = Result.Nodes.getNodeAs<VarDecl>("node")) {
     if (D->hasGlobalStorage()) {
       Variety = AV_Global;
     } else {
       Variety = AV_Automatic;
     }
     T = D->getType();
-    Loc = D->getLocStart();
+    Loc = D->getBeginLoc();
   } else if (const CXXNewExpr *E = Result.Nodes.getNodeAs<CXXNewExpr>("node")) {
     // New allocates things on the heap.
     // We don't consider placement new to do anything, as it doesn't actually
     // allocate the storage, and thus gives us no useful information.
     if (!isPlacementNew(E)) {
       Variety = AV_Heap;
       T = E->getAllocatedType();
-      Loc = E->getLocStart();
+      Loc = E->getBeginLoc();
     }
   } else if (const MaterializeTemporaryExpr *E =
                  Result.Nodes.getNodeAs<MaterializeTemporaryExpr>("node")) {
     // Temporaries can actually have varying storage durations, due to temporary
     // lifetime extension. We consider the allocation variety of this temporary
     // to be the same as the allocation variety of its lifetime.
 
     // XXX We maybe should mark these lifetimes as being due to a temporary
@@ -103,24 +103,24 @@ void ScopeChecker::check(const MatchFind
       Variety = AV_Global;
       break;
     case SD_Dynamic:
       assert(false && "I don't think that this ever should occur...");
       Variety = AV_Heap;
       break;
     }
     T = E->getType().getUnqualifiedType();
-    Loc = E->getLocStart();
+    Loc = E->getBeginLoc();
   } else if (const CallExpr *E = Result.Nodes.getNodeAs<CallExpr>("node")) {
     T = E->getType()->getPointeeType();
     if (!T.isNull()) {
       // This will always allocate on the heap, as the heapAllocator() check
       // was made in the matcher
       Variety = AV_Heap;
-      Loc = E->getLocStart();
+      Loc = E->getBeginLoc();
     }
   }
 
   // Error messages for incorrect allocations.
   const char *Stack = "variable of type %0 only valid on the stack";
   const char *Global = "variable of type %0 only valid as global";
   const char *Heap = "variable of type %0 only valid on the heap";
   const char *NonHeap = "variable of type %0 is not valid on the heap";
--- a/build/clang-plugin/SprintfLiteralChecker.cpp
+++ b/build/clang-plugin/SprintfLiteralChecker.cpp
@@ -48,18 +48,18 @@ void SprintfLiteralChecker::check(const 
   const DeclRefExpr *Buffer = Result.Nodes.getNodeAs<DeclRefExpr>("buffer");
   const DeclRefExpr *Size = Result.Nodes.getNodeAs<DeclRefExpr>("size");
   if (Size) {
     // Match calls like snprintf(x, sizeof(x), ...).
     if (Buffer->getFoundDecl() != Size->getFoundDecl()) {
       return;
     }
 
-    diag(D->getLocStart(), Error, DiagnosticIDs::Error) << Name << Replacement;
-    diag(D->getLocStart(), Note, DiagnosticIDs::Note) << Name;
+    diag(D->getBeginLoc(), Error, DiagnosticIDs::Error) << Name << Replacement;
+    diag(D->getBeginLoc(), Note, DiagnosticIDs::Note) << Name;
     return;
   }
 
   const QualType QType = Buffer->getType();
   const ConstantArrayType *Type =
       dyn_cast<ConstantArrayType>(QType.getTypePtrOrNull());
   if (Type) {
     // Match calls like snprintf(x, 100, ...), where x is int[100];
@@ -71,14 +71,14 @@ void SprintfLiteralChecker::check(const 
     }
 
     // We're going to assume here that the bitwidth of both of these values fits
     // within 64 bits. and zero-extend both values to 64-bits before comparing
     // them.
     uint64_t Size = Type->getSize().getZExtValue();
     uint64_t Lit = Literal->getValue().getZExtValue();
     if (Size <= Lit) {
-      diag(D->getLocStart(), Error, DiagnosticIDs::Error)
+      diag(D->getBeginLoc(), Error, DiagnosticIDs::Error)
           << Name << Replacement;
-      diag(D->getLocStart(), Note, DiagnosticIDs::Note) << Name;
+      diag(D->getBeginLoc(), Note, DiagnosticIDs::Note) << Name;
     }
   }
 }
--- a/build/clang-plugin/TrivialCtorDtorChecker.cpp
+++ b/build/clang-plugin/TrivialCtorDtorChecker.cpp
@@ -20,10 +20,10 @@ void TrivialCtorDtorChecker::check(const
 
   // We need to accept non-constexpr trivial constructors as well. This occurs
   // when a struct contains pod members, which will not be initialized. As
   // constexpr values are initialized, the constructor is non-constexpr.
   bool BadCtor = !(Node->hasConstexprDefaultConstructor() ||
                    Node->hasTrivialDefaultConstructor());
   bool BadDtor = !Node->hasTrivialDestructor();
   if (BadCtor || BadDtor)
-    diag(Node->getLocStart(), Error, DiagnosticIDs::Error) << Node;
+    diag(Node->getBeginLoc(), Error, DiagnosticIDs::Error) << Node;
 }
--- a/build/clang-plugin/Utils.h
+++ b/build/clang-plugin/Utils.h
@@ -33,17 +33,17 @@ inline bool hasSideEffectAssignment(cons
   }
 
   return false;
 }
 
 template <class T>
 inline bool ASTIsInSystemHeader(const ASTContext &AC, const T &D) {
   auto &SourceManager = AC.getSourceManager();
-  auto ExpansionLoc = SourceManager.getExpansionLoc(D.getLocStart());
+  auto ExpansionLoc = SourceManager.getExpansionLoc(D.getBeginLoc());
   if (ExpansionLoc.isInvalid()) {
     return false;
   }
   return SourceManager.isInSystemHeader(ExpansionLoc);
 }
 
 template <typename T> inline StringRef getNameChecked(const T &D) {
   return D->getIdentifier() ? D->getName() : "";
@@ -196,17 +196,17 @@ inline bool isIgnoredPathForImplicitConv
       return Begin != End && Begin->compare_lower(StringRef("sandbox")) == 0;
     }
   }
   return false;
 }
 
 inline bool isIgnoredPathForSprintfLiteral(const CallExpr *Call,
                                            const SourceManager &SM) {
-  SourceLocation Loc = Call->getLocStart();
+  SourceLocation Loc = Call->getBeginLoc();
   SmallString<1024> FileName = SM.getFilename(Loc);
   llvm::sys::fs::make_absolute(FileName);
   llvm::sys::path::reverse_iterator Begin = llvm::sys::path::rbegin(FileName),
                                     End = llvm::sys::path::rend(FileName);
   for (; Begin != End; ++Begin) {
     if (Begin->compare_lower(StringRef("angle")) == 0 ||
         Begin->compare_lower(StringRef("chromium")) == 0 ||
         Begin->compare_lower(StringRef("crashreporter")) == 0 ||
@@ -423,17 +423,17 @@ inline CXXRecordDecl *getNonTemplateSpec
   return D;
 }
 
 inline bool inThirdPartyPath(const Decl *D) {
   return inThirdPartyPath(D, &D->getASTContext());
 }
 
 inline bool inThirdPartyPath(const Stmt *S, ASTContext *context) {
-  SourceLocation Loc = S->getLocStart();
+  SourceLocation Loc = S->getBeginLoc();
   const SourceManager &SM = context->getSourceManager();
   auto ExpansionLoc = SM.getExpansionLoc(Loc);
   if (ExpansionLoc.isInvalid()) {
     return inThirdPartyPath(Loc, SM);
   }
   return inThirdPartyPath(ExpansionLoc, SM);
 }
 
--- a/build/clang-plugin/mozsearch-plugin/MozsearchIndexer.cpp
+++ b/build/clang-plugin/mozsearch-plugin/MozsearchIndexer.cpp
@@ -29,16 +29,22 @@
 
 #include <stdio.h>
 #include <stdlib.h>
 
 #include "FileOperations.h"
 #include "JSONFormatter.h"
 #include "StringOperations.h"
 
+#if CLANG_VERSION_FULL < 800
+// Starting with Clang 8.0 some basic functions have been renamed
+#define getBeginLoc getLocStart
+#define getEndLoc getLocEnd
+#endif
+
 using namespace clang;
 
 const std::string GENERATED("__GENERATED__" PATHSEP_STRING);
 
 // Absolute path to directory containing source code.
 std::string Srcdir;
 
 // Absolute path to objdir (including generated code).
@@ -1016,17 +1022,17 @@ public:
     // But if there are parameters, we want to include those as well.
     for (ParmVarDecl* Param : D->parameters()) {
       std::pair<FileID, unsigned> ParamLoc = SM.getDecomposedLoc(Param->getLocation());
 
       // It's possible there are macros involved or something. We don't include
       // the parameters in that case.
       if (ParamLoc.first == FuncLoc.first) {
         // Assume parameters are in order, so we always take the last one.
-        End = Param->getLocEnd();
+        End = Param->getEndLoc();
       }
     }
 
     return SourceRange(Start, End);
   }
 
   SourceRange getTagPeekRange(TagDecl* D) {
     SourceLocation Start = D->getLocStart();
@@ -1034,23 +1040,23 @@ public:
     // By default, we end at the line containing the name.
     SourceLocation End = D->getLocation();
 
     std::pair<FileID, unsigned> FuncLoc = SM.getDecomposedLoc(End);
 
     if (CXXRecordDecl* D2 = dyn_cast<CXXRecordDecl>(D)) {
       // But if there are parameters, we want to include those as well.
       for (CXXBaseSpecifier& Base : D2->bases()) {
-        std::pair<FileID, unsigned> Loc = SM.getDecomposedLoc(Base.getLocEnd());
+        std::pair<FileID, unsigned> Loc = SM.getDecomposedLoc(Base.getEndLoc());
 
         // It's possible there are macros involved or something. We don't include
         // the parameters in that case.
         if (Loc.first == FuncLoc.first) {
           // Assume parameters are in order, so we always take the last one.
-          End = Base.getLocEnd();
+          End = Base.getEndLoc();
         }
       }
     }
 
     return SourceRange(Start, End);
   }
 
   SourceRange getCommentRange(NamedDecl* D) {
@@ -1123,17 +1129,17 @@ public:
     if (isa<ParmVarDecl>(D) && !D->getDeclName().getAsIdentifierInfo()) {
       // Unnamed parameter in function proto.
       return true;
     }
 
     int Flags = 0;
     const char *Kind = "def";
     const char *PrettyKind = "?";
-    SourceRange PeekRange(D->getLocStart(), D->getLocEnd());
+    SourceRange PeekRange(D->getBeginLoc(), D->getEndLoc());
     if (FunctionDecl *D2 = dyn_cast<FunctionDecl>(D)) {
       if (D2->isTemplateInstantiation()) {
         D = D2->getTemplateInstantiationPattern();
       }
       Kind = D2->isThisDeclarationADefinition() ? "def" : "decl";
       PrettyKind = "function";
       PeekRange = getFunctionPeekRange(D2);
     } else if (TagDecl *D2 = dyn_cast<TagDecl>(D)) {
--- a/build/clang-plugin/plugin.h
+++ b/build/clang-plugin/plugin.h
@@ -28,16 +28,22 @@ using namespace clang;
 using namespace clang::ast_matchers;
 
 #if CLANG_VERSION_FULL >= 306
 typedef std::unique_ptr<ASTConsumer> ASTConsumerPtr;
 #else
 typedef ASTConsumer *ASTConsumerPtr;
 #endif
 
+#if CLANG_VERSION_FULL < 800
+// Starting with Clang 8.0 some basic functions have been renamed
+#define getBeginLoc getLocStart
+#define getEndLoc getLocEnd
+#endif
+
 #ifndef HAVE_NEW_ASTMATCHER_NAMES
 // In clang 3.8, a number of AST matchers were renamed to better match the
 // respective AST node.  We use the new names, and #define them to the old
 // ones for compatibility with older versions.
 #define cxxConstructExpr constructExpr
 #define cxxConstructorDecl constructorDecl
 #define cxxMethodDecl methodDecl
 #define cxxNewExpr newExpr