aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2018-08-29 17:50:47 +0000
committerDimitry Andric <dim@FreeBSD.org>2018-08-29 17:50:47 +0000
commitfe208f5606bc4a82b573ac32db2897616d3abc24 (patch)
treeb24eb98bb9dcd177f8892ec5c1e09978c0977a7c
parent5a4cb1eb0c4e2560397c009da45d57bb1ebb6135 (diff)
downloadsrc-fe208f5606bc4a82b573ac32db2897616d3abc24.tar.gz
src-fe208f5606bc4a82b573ac32db2897616d3abc24.zip
Vendor import of clang release_70 branch r340910:vendor/clang/clang-release_70-r340910
Notes
Notes: svn path=/vendor/clang/dist-release_70/; revision=338380 svn path=/vendor/clang/clang-release_70-r340910/; revision=338381; tag=vendor/clang/clang-release_70-r340910
-rw-r--r--docs/ReleaseNotes.rst32
-rw-r--r--docs/UsersManual.rst19
-rw-r--r--include/clang/AST/Comment.h10
-rw-r--r--include/clang/AST/Decl.h12
-rw-r--r--include/clang/AST/DeclBase.h6
-rw-r--r--include/clang/AST/DeclCXX.h9
-rw-r--r--include/clang/AST/DeclObjC.h9
-rw-r--r--include/clang/AST/DeclarationName.h11
-rw-r--r--include/clang/AST/Expr.h282
-rw-r--r--include/clang/AST/ExprCXX.h271
-rw-r--r--include/clang/AST/ExprObjC.h98
-rw-r--r--include/clang/AST/ExprOpenMP.h6
-rw-r--r--include/clang/AST/OpenMPClause.h6
-rw-r--r--include/clang/AST/RawCommentList.h6
-rw-r--r--include/clang/AST/Stmt.h159
-rw-r--r--include/clang/AST/StmtCXX.h35
-rw-r--r--include/clang/AST/StmtObjC.h44
-rw-r--r--include/clang/AST/StmtOpenMP.h6
-rw-r--r--include/clang/Analysis/CloneDetection.h3
-rw-r--r--include/clang/Basic/BuiltinsX86_64.def2
-rw-r--r--include/clang/Sema/DeclSpec.h18
-rw-r--r--lib/AST/DeclObjC.cpp2
-rw-r--r--lib/AST/Expr.cpp24
-rw-r--r--lib/AST/ExprCXX.cpp18
-rw-r--r--lib/AST/MicrosoftMangle.cpp51
-rw-r--r--lib/AST/Stmt.cpp6
-rw-r--r--lib/AST/StmtObjC.cpp2
-rw-r--r--lib/Analysis/CloneDetection.cpp2
-rw-r--r--lib/Basic/Targets/X86.h8
-rw-r--r--lib/CodeGen/CGBuiltin.cpp21
-rw-r--r--lib/CodeGen/CGExpr.cpp3
-rw-r--r--lib/CodeGen/CodeGenModule.cpp20
-rw-r--r--lib/CodeGen/CoverageMappingGen.cpp3
-rw-r--r--lib/Headers/intrin.h14
-rw-r--r--lib/Sema/SemaChecking.cpp6
-rw-r--r--lib/Sema/SemaInit.cpp4
-rw-r--r--test/CodeGen/ms-x86-intrinsics.c32
-rw-r--r--test/CodeGenCXX/atomic-inline.cpp61
-rw-r--r--test/CodeGenCXX/block-byref.cpp15
-rw-r--r--test/CodeGenCXX/cfi-cross-dso.cpp2
-rw-r--r--test/CodeGenCXX/cfi-icall.cpp2
-rw-r--r--test/CodeGenCXX/debug-info-thunk.cpp2
-rw-r--r--test/CodeGenCXX/dllexport.cpp2
-rw-r--r--test/CodeGenCXX/mangle-ms.cpp2
-rw-r--r--test/CodeGenCXX/microsoft-abi-structors.cpp4
-rw-r--r--test/CodeGenCXX/microsoft-abi-throw.cpp4
-rw-r--r--test/CodeGenCXX/microsoft-abi-thunks.cpp2
-rw-r--r--test/CodeGenCXX/microsoft-abi-vftables.cpp6
-rw-r--r--test/CodeGenCXX/microsoft-abi-virtual-member-pointers.cpp8
-rw-r--r--test/CodeGenCXX/msabi-swiftcall-cc.cpp8
-rw-r--r--test/CodeGenCXX/pragma-init_seg.cpp4
-rw-r--r--test/CodeGenCXX/type-metadata.cpp14
-rw-r--r--test/Headers/ms-intrin.cpp2
-rw-r--r--test/OpenMP/declare_target_codegen.cpp14
-rw-r--r--test/Sema/statements.c9
55 files changed, 919 insertions, 502 deletions
diff --git a/docs/ReleaseNotes.rst b/docs/ReleaseNotes.rst
index 06512d067e55..71df974ae151 100644
--- a/docs/ReleaseNotes.rst
+++ b/docs/ReleaseNotes.rst
@@ -222,10 +222,31 @@ Objective-C Language Changes in Clang
...
-OpenCL C Language Changes in Clang
-----------------------------------
+OpenCL C/C++ Language Changes in Clang
+--------------------------------------
-...
+Miscellaneous changes in OpenCL C:
+
+- Added ``cles_khr_int64`` extension.
+
+- Added bug fixes and simplifications to Clang blocks in OpenCL mode.
+
+- Added compiler flag ``-cl-uniform-work-group-size`` to allow extra compile time optimisation.
+
+- Propagate ``denorms-are-zero`` attribute to IR if ``-cl-denorms-are-zero`` is passed to the compiler.
+
+- Separated ``read_only`` and ``write_only`` pipe IR types.
+
+- Fixed address space for the ``__func__`` predefined macro.
+
+- Improved diagnostics of kernel argument types.
+
+
+Started OpenCL C++ support:
+
+- Added ``-std/-cl-std=c++``.
+
+- Added support for keywords.
OpenMP Support in Clang
----------------------------------
@@ -265,7 +286,10 @@ These are major API changes that have happened since the 6.0.0 release of
Clang. If upgrading an external codebase that uses Clang as a library,
this section should help get you past the largest hurdles of upgrading.
-- ...
+- The methods ``getLocStart``, ``getStartLoc`` and ``getLocEnd`` in the AST
+ classes are deprecated. New APIs ``getBeginLoc`` and ``getEndLoc`` should
+ be used instead. While the old methods remain in this release, they will
+ not be present in the next release of Clang.
AST Matchers
------------
diff --git a/docs/UsersManual.rst b/docs/UsersManual.rst
index 363bb4e461a6..e0dc31f432fa 100644
--- a/docs/UsersManual.rst
+++ b/docs/UsersManual.rst
@@ -2711,16 +2711,17 @@ Command Prompt or a regular Command Prompt where the environment has been set
up using e.g. `vcvarsall.bat <http://msdn.microsoft.com/en-us/library/f2ccy3wt.aspx>`_.
clang-cl can also be used from inside Visual Studio by selecting the LLVM
-Platform Toolset. The toolset is installed by the LLVM installer, which can be
-downloaded from the `LLVM release <http://releases.llvm.org/download.html>`_ or
-`snapshot build <http://llvm.org/builds/>`_ web pages. To use the toolset,
-select a project in Solution Explorer, open its Property Page (Alt+F7), and in
-the "General" section of "Configuration Properties" change "Platform Toolset"
-to e.g. LLVM-vs2014.
+Platform Toolset. The toolset is not part of the installer, but may be installed
+separately from the
+`Visual Studio Marketplace <https://marketplace.visualstudio.com/items?itemName=LLVMExtensions.llvm-toolchain>`_.
+To use the toolset, select a project in Solution Explorer, open its Property
+Page (Alt+F7), and in the "General" section of "Configuration Properties"
+change "Platform Toolset" to LLVM. Doing so enables an additional Property
+Page for selecting the clang-cl executable to use for builds.
To use the toolset with MSBuild directly, invoke it with e.g.
-``/p:PlatformToolset=LLVM-vs2014``. This allows trying out the clang-cl
-toolchain without modifying your project files.
+``/p:PlatformToolset=LLVM``. This allows trying out the clang-cl toolchain
+without modifying your project files.
It's also possible to point MSBuild at clang-cl without changing toolset by
passing ``/p:CLToolPath=c:\llvm\bin /p:CLToolExe=clang-cl.exe``.
@@ -2729,7 +2730,7 @@ When using CMake and the Visual Studio generators, the toolset can be set with t
::
- cmake -G"Visual Studio 15 2017" -T LLVM-vs2014 ..
+ cmake -G"Visual Studio 15 2017" -T LLVM ..
When using CMake with the Ninja generator, set the ``CMAKE_C_COMPILER`` and
``CMAKE_CXX_COMPILER`` variables to clang-cl:
diff --git a/include/clang/AST/Comment.h b/include/clang/AST/Comment.h
index f5538dec2a14..030a5a89e492 100644
--- a/include/clang/AST/Comment.h
+++ b/include/clang/AST/Comment.h
@@ -215,13 +215,11 @@ public:
SourceRange getSourceRange() const LLVM_READONLY { return Range; }
- SourceLocation getLocStart() const LLVM_READONLY {
- return Range.getBegin();
- }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return Range.getBegin(); }
- SourceLocation getLocEnd() const LLVM_READONLY {
- return Range.getEnd();
- }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return Range.getEnd(); }
SourceLocation getLocation() const LLVM_READONLY { return Loc; }
diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h
index ebdb2890daf5..6885968bae60 100644
--- a/include/clang/AST/Decl.h
+++ b/include/clang/AST/Decl.h
@@ -614,7 +614,8 @@ public:
return SourceRange(LocStart, RBraceLoc);
}
- SourceLocation getLocStart() const LLVM_READONLY { return LocStart; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return LocStart; }
SourceLocation getRBraceLoc() const { return RBraceLoc; }
void setLocStart(SourceLocation L) { LocStart = L; }
void setRBraceLoc(SourceLocation L) { RBraceLoc = L; }
@@ -735,7 +736,8 @@ public:
SourceRange getSourceRange() const override LLVM_READONLY;
- SourceLocation getLocStart() const LLVM_READONLY {
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY {
return getOuterLocStart();
}
@@ -2851,7 +2853,8 @@ public:
const Type *getTypeForDecl() const { return TypeForDecl; }
void setTypeForDecl(const Type *TD) { TypeForDecl = TD; }
- SourceLocation getLocStart() const LLVM_READONLY { return LocStart; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return LocStart; }
void setLocStart(SourceLocation L) { LocStart = L; }
SourceRange getSourceRange() const override LLVM_READONLY {
if (LocStart.isValid())
@@ -4223,7 +4226,8 @@ public:
SourceLocation getRBraceLoc() const { return RBraceLoc; }
void setRBraceLoc(SourceLocation L) { RBraceLoc = L; }
- SourceLocation getLocEnd() const LLVM_READONLY {
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
if (RBraceLoc.isValid())
return RBraceLoc;
// No braces: get the end location of the (only) declaration in context
diff --git a/include/clang/AST/DeclBase.h b/include/clang/AST/DeclBase.h
index d6b89d971d94..81df1c0b6aa9 100644
--- a/include/clang/AST/DeclBase.h
+++ b/include/clang/AST/DeclBase.h
@@ -406,11 +406,13 @@ public:
return SourceRange(getLocation(), getLocation());
}
- SourceLocation getLocStart() const LLVM_READONLY {
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY {
return getSourceRange().getBegin();
}
- SourceLocation getLocEnd() const LLVM_READONLY {
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
return getSourceRange().getEnd();
}
diff --git a/include/clang/AST/DeclCXX.h b/include/clang/AST/DeclCXX.h
index 4353f66a34e4..bc478f6334ad 100644
--- a/include/clang/AST/DeclCXX.h
+++ b/include/clang/AST/DeclCXX.h
@@ -233,8 +233,10 @@ public:
/// Retrieves the source range that contains the entire base specifier.
SourceRange getSourceRange() const LLVM_READONLY { return Range; }
- SourceLocation getLocStart() const LLVM_READONLY { return Range.getBegin(); }
- SourceLocation getLocEnd() const LLVM_READONLY { return Range.getEnd(); }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return Range.getBegin(); }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return Range.getEnd(); }
/// Get the location at which the base class type was written.
SourceLocation getBaseTypeLoc() const LLVM_READONLY {
@@ -2884,7 +2886,8 @@ public:
HasBraces = RBraceLoc.isValid();
}
- SourceLocation getLocEnd() const LLVM_READONLY {
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
if (hasBraces())
return getRBraceLoc();
// No braces: get the end location of the (only) declaration in context
diff --git a/include/clang/AST/DeclObjC.h b/include/clang/AST/DeclObjC.h
index c1cc726e3152..926b5e3f1ee5 100644
--- a/include/clang/AST/DeclObjC.h
+++ b/include/clang/AST/DeclObjC.h
@@ -318,8 +318,10 @@ public:
SourceLocation getDeclaratorEndLoc() const { return DeclEndLoc; }
// Location information, modeled after the Stmt API.
- SourceLocation getLocStart() const LLVM_READONLY { return getLocation(); }
- SourceLocation getLocEnd() const LLVM_READONLY;
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return getLocation(); }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY;
SourceRange getSourceRange() const override LLVM_READONLY {
return SourceRange(getLocation(), getLocEnd());
}
@@ -2831,7 +2833,8 @@ public:
SourceRange getSourceRange() const override LLVM_READONLY;
- SourceLocation getLocStart() const LLVM_READONLY { return AtLoc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return AtLoc; }
void setAtLoc(SourceLocation Loc) { AtLoc = Loc; }
ObjCPropertyDecl *getPropertyDecl() const {
diff --git a/include/clang/AST/DeclarationName.h b/include/clang/AST/DeclarationName.h
index 856f3ab5720e..ed0429039cd0 100644
--- a/include/clang/AST/DeclarationName.h
+++ b/include/clang/AST/DeclarationName.h
@@ -557,22 +557,19 @@ public:
/// getBeginLoc - Retrieve the location of the first token.
SourceLocation getBeginLoc() const { return NameLoc; }
- /// getEndLoc - Retrieve the location of the last token.
- SourceLocation getEndLoc() const { return getLocEnd(); }
-
/// getSourceRange - The range of the declaration name.
SourceRange getSourceRange() const LLVM_READONLY {
return SourceRange(getLocStart(), getLocEnd());
}
- SourceLocation getLocStart() const LLVM_READONLY {
- return getBeginLoc();
- }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
- SourceLocation getLocEnd() const LLVM_READONLY {
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
SourceLocation EndLoc = getEndLocPrivate();
return EndLoc.isValid() ? EndLoc : getLocStart();
}
+
private:
SourceLocation getEndLocPrivate() const;
};
diff --git a/include/clang/AST/Expr.h b/include/clang/AST/Expr.h
index c18fbf05df68..e7e32b9fe1ad 100644
--- a/include/clang/AST/Expr.h
+++ b/include/clang/AST/Expr.h
@@ -904,10 +904,12 @@ public:
/// Retrieve the location of this expression.
SourceLocation getLocation() const { return Loc; }
- SourceLocation getLocStart() const LLVM_READONLY {
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY {
return SourceExpr ? SourceExpr->getLocStart() : Loc;
}
- SourceLocation getLocEnd() const LLVM_READONLY {
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
return SourceExpr ? SourceExpr->getLocEnd() : Loc;
}
SourceLocation getExprLoc() const LLVM_READONLY {
@@ -1064,8 +1066,10 @@ public:
SourceLocation getLocation() const { return Loc; }
void setLocation(SourceLocation L) { Loc = L; }
- SourceLocation getLocStart() const LLVM_READONLY;
- SourceLocation getLocEnd() const LLVM_READONLY;
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY;
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY;
/// Determine whether this declaration reference was preceded by a
/// C++ nested-name-specifier, e.g., \c N::foo.
@@ -1242,8 +1246,10 @@ public:
static StringRef getIdentTypeName(IdentType IT);
static std::string ComputeName(IdentType IT, const Decl *CurrentDecl);
- SourceLocation getLocStart() const LLVM_READONLY { return Loc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return Loc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return Loc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return Loc; }
static bool classof(const Stmt *T) {
return T->getStmtClass() == PredefinedExprClass;
@@ -1331,8 +1337,10 @@ public:
/// Returns a new empty integer literal.
static IntegerLiteral *Create(const ASTContext &C, EmptyShell Empty);
- SourceLocation getLocStart() const LLVM_READONLY { return Loc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return Loc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return Loc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return Loc; }
/// Retrieve the location of the literal.
SourceLocation getLocation() const { return Loc; }
@@ -1370,8 +1378,10 @@ class FixedPointLiteral : public Expr, public APIntStorage {
QualType type, SourceLocation l,
unsigned Scale);
- SourceLocation getLocStart() const LLVM_READONLY { return Loc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return Loc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return Loc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return Loc; }
/// \brief Retrieve the location of the literal.
SourceLocation getLocation() const { return Loc; }
@@ -1424,8 +1434,10 @@ public:
return static_cast<CharacterKind>(CharacterLiteralBits.Kind);
}
- SourceLocation getLocStart() const LLVM_READONLY { return Loc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return Loc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return Loc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return Loc; }
unsigned getValue() const { return Value; }
@@ -1497,8 +1509,10 @@ public:
SourceLocation getLocation() const { return Loc; }
void setLocation(SourceLocation L) { Loc = L; }
- SourceLocation getLocStart() const LLVM_READONLY { return Loc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return Loc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return Loc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return Loc; }
static bool classof(const Stmt *T) {
return T->getStmtClass() == FloatingLiteralClass;
@@ -1534,8 +1548,12 @@ public:
Expr *getSubExpr() { return cast<Expr>(Val); }
void setSubExpr(Expr *E) { Val = E; }
- SourceLocation getLocStart() const LLVM_READONLY { return Val->getLocStart(); }
- SourceLocation getLocEnd() const LLVM_READONLY { return Val->getLocEnd(); }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY {
+ return Val->getLocStart();
+ }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return Val->getLocEnd(); }
static bool classof(const Stmt *T) {
return T->getStmtClass() == ImaginaryLiteralClass;
@@ -1708,8 +1726,10 @@ public:
tokloc_iterator tokloc_begin() const { return TokLocs; }
tokloc_iterator tokloc_end() const { return TokLocs + NumConcatenated; }
- SourceLocation getLocStart() const LLVM_READONLY { return TokLocs[0]; }
- SourceLocation getLocEnd() const LLVM_READONLY {
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return TokLocs[0]; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
return TokLocs[NumConcatenated - 1];
}
@@ -1748,8 +1768,10 @@ public:
Expr *getSubExpr() { return cast<Expr>(Val); }
void setSubExpr(Expr *E) { Val = E; }
- SourceLocation getLocStart() const LLVM_READONLY { return L; }
- SourceLocation getLocEnd() const LLVM_READONLY { return R; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return L; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return R; }
/// Get the location of the left parentheses '('.
SourceLocation getLParen() const { return L; }
@@ -1872,10 +1894,12 @@ public:
/// the given unary opcode.
static OverloadedOperatorKind getOverloadedOperator(Opcode Opc);
- SourceLocation getLocStart() const LLVM_READONLY {
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY {
return isPostfix() ? Val->getLocStart() : Loc;
}
- SourceLocation getLocEnd() const LLVM_READONLY {
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
return isPostfix() ? Loc : Val->getLocEnd();
}
SourceLocation getExprLoc() const LLVM_READONLY { return Loc; }
@@ -1980,8 +2004,10 @@ public:
/// contains the location of the period (if there is one) and the
/// identifier.
SourceRange getSourceRange() const LLVM_READONLY { return Range; }
- SourceLocation getLocStart() const LLVM_READONLY { return Range.getBegin(); }
- SourceLocation getLocEnd() const LLVM_READONLY { return Range.getEnd(); }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return Range.getBegin(); }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return Range.getEnd(); }
};
/// OffsetOfExpr - [C99 7.17] - This represents an expression of the form
@@ -2080,8 +2106,10 @@ public:
return NumExprs;
}
- SourceLocation getLocStart() const LLVM_READONLY { return OperatorLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return RParenLoc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return OperatorLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; }
static bool classof(const Stmt *T) {
return T->getStmtClass() == OffsetOfExprClass;
@@ -2176,8 +2204,10 @@ public:
SourceLocation getRParenLoc() const { return RParenLoc; }
void setRParenLoc(SourceLocation L) { RParenLoc = L; }
- SourceLocation getLocStart() const LLVM_READONLY { return OpLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return RParenLoc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return OpLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; }
static bool classof(const Stmt *T) {
return T->getStmtClass() == UnaryExprOrTypeTraitExprClass;
@@ -2250,10 +2280,12 @@ public:
return getRHS()->getType()->isIntegerType() ? getRHS() : getLHS();
}
- SourceLocation getLocStart() const LLVM_READONLY {
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY {
return getLHS()->getLocStart();
}
- SourceLocation getLocEnd() const LLVM_READONLY { return RBracketLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return RBracketLoc; }
SourceLocation getRBracketLoc() const { return RBracketLoc; }
void setRBracketLoc(SourceLocation L) { RBracketLoc = L; }
@@ -2420,8 +2452,10 @@ public:
SourceLocation getRParenLoc() const { return RParenLoc; }
void setRParenLoc(SourceLocation L) { RParenLoc = L; }
- SourceLocation getLocStart() const LLVM_READONLY;
- SourceLocation getLocEnd() const LLVM_READONLY;
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY;
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY;
/// Return true if this is a call to __assume() or __builtin_assume() with
/// a non-value-dependent constant parameter evaluating as false.
@@ -2666,8 +2700,10 @@ public:
SourceLocation getMemberLoc() const { return MemberLoc; }
void setMemberLoc(SourceLocation L) { MemberLoc = L; }
- SourceLocation getLocStart() const LLVM_READONLY;
- SourceLocation getLocEnd() const LLVM_READONLY;
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY;
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY;
SourceLocation getExprLoc() const LLVM_READONLY { return MemberLoc; }
@@ -2756,7 +2792,8 @@ public:
TInfoAndScope.setPointer(tinfo);
}
- SourceLocation getLocStart() const LLVM_READONLY {
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY {
// FIXME: Init should never be null.
if (!Init)
return SourceLocation();
@@ -2764,7 +2801,8 @@ public:
return Init->getLocStart();
return LParenLoc;
}
- SourceLocation getLocEnd() const LLVM_READONLY {
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
// FIXME: Init should never be null.
if (!Init)
return SourceLocation();
@@ -2958,10 +2996,12 @@ public:
static ImplicitCastExpr *CreateEmpty(const ASTContext &Context,
unsigned PathSize);
- SourceLocation getLocStart() const LLVM_READONLY {
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY {
return getSubExpr()->getLocStart();
}
- SourceLocation getLocEnd() const LLVM_READONLY {
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
return getSubExpr()->getLocEnd();
}
@@ -3067,8 +3107,10 @@ public:
SourceLocation getRParenLoc() const { return RPLoc; }
void setRParenLoc(SourceLocation L) { RPLoc = L; }
- SourceLocation getLocStart() const LLVM_READONLY { return LPLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY {
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return LPLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
return getSubExpr()->getLocEnd();
}
@@ -3147,10 +3189,12 @@ public:
Expr *getRHS() const { return cast<Expr>(SubExprs[RHS]); }
void setRHS(Expr *E) { SubExprs[RHS] = E; }
- SourceLocation getLocStart() const LLVM_READONLY {
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY {
return getLHS()->getLocStart();
}
- SourceLocation getLocEnd() const LLVM_READONLY {
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
return getRHS()->getLocEnd();
}
@@ -3430,10 +3474,12 @@ public:
Expr *getLHS() const { return cast<Expr>(SubExprs[LHS]); }
Expr *getRHS() const { return cast<Expr>(SubExprs[RHS]); }
- SourceLocation getLocStart() const LLVM_READONLY {
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY {
return getCond()->getLocStart();
}
- SourceLocation getLocEnd() const LLVM_READONLY {
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
return getRHS()->getLocEnd();
}
@@ -3518,10 +3564,12 @@ public:
return cast<Expr>(SubExprs[RHS]);
}
- SourceLocation getLocStart() const LLVM_READONLY {
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY {
return getCommon()->getLocStart();
}
- SourceLocation getLocEnd() const LLVM_READONLY {
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
return getFalseExpr()->getLocEnd();
}
@@ -3576,8 +3624,10 @@ public:
SourceLocation getLabelLoc() const { return LabelLoc; }
void setLabelLoc(SourceLocation L) { LabelLoc = L; }
- SourceLocation getLocStart() const LLVM_READONLY { return AmpAmpLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return LabelLoc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return AmpAmpLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return LabelLoc; }
LabelDecl *getLabel() const { return Label; }
void setLabel(LabelDecl *L) { Label = L; }
@@ -3621,8 +3671,10 @@ public:
const CompoundStmt *getSubStmt() const { return cast<CompoundStmt>(SubStmt); }
void setSubStmt(CompoundStmt *S) { SubStmt = S; }
- SourceLocation getLocStart() const LLVM_READONLY { return LParenLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return RParenLoc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return LParenLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; }
SourceLocation getLParenLoc() const { return LParenLoc; }
void setLParenLoc(SourceLocation L) { LParenLoc = L; }
@@ -3670,8 +3722,10 @@ public:
SourceLocation getRParenLoc() const { return RParenLoc; }
void setRParenLoc(SourceLocation L) { RParenLoc = L; }
- SourceLocation getLocStart() const LLVM_READONLY { return BuiltinLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return RParenLoc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return BuiltinLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; }
static bool classof(const Stmt *T) {
return T->getStmtClass() == ShuffleVectorExprClass;
@@ -3754,8 +3808,10 @@ public:
/// getRParenLoc - Return the location of final right parenthesis.
SourceLocation getRParenLoc() const { return RParenLoc; }
- SourceLocation getLocStart() const LLVM_READONLY { return BuiltinLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return RParenLoc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return BuiltinLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; }
static bool classof(const Stmt *T) {
return T->getStmtClass() == ConvertVectorExprClass;
@@ -3835,8 +3891,10 @@ public:
SourceLocation getRParenLoc() const { return RParenLoc; }
void setRParenLoc(SourceLocation L) { RParenLoc = L; }
- SourceLocation getLocStart() const LLVM_READONLY { return BuiltinLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return RParenLoc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return BuiltinLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; }
static bool classof(const Stmt *T) {
return T->getStmtClass() == ChooseExprClass;
@@ -3874,8 +3932,10 @@ public:
SourceLocation getTokenLocation() const { return TokenLoc; }
void setTokenLocation(SourceLocation L) { TokenLoc = L; }
- SourceLocation getLocStart() const LLVM_READONLY { return TokenLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return TokenLoc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return TokenLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return TokenLoc; }
static bool classof(const Stmt *T) {
return T->getStmtClass() == GNUNullExprClass;
@@ -3926,8 +3986,10 @@ public:
SourceLocation getRParenLoc() const { return RParenLoc; }
void setRParenLoc(SourceLocation L) { RParenLoc = L; }
- SourceLocation getLocStart() const LLVM_READONLY { return BuiltinLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return RParenLoc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return BuiltinLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; }
static bool classof(const Stmt *T) {
return T->getStmtClass() == VAArgExprClass;
@@ -4160,8 +4222,10 @@ public:
InitListExprBits.HadArrayRangeDesignator = ARD;
}
- SourceLocation getLocStart() const LLVM_READONLY;
- SourceLocation getLocEnd() const LLVM_READONLY;
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY;
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY;
static bool classof(const Stmt *T) {
return T->getStmtClass() == InitListExprClass;
@@ -4395,13 +4459,15 @@ public:
return ArrayOrRange.Index;
}
- SourceLocation getLocStart() const LLVM_READONLY {
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY {
if (Kind == FieldDesignator)
return getDotLoc().isInvalid()? getFieldLoc() : getDotLoc();
else
return getLBracketLoc();
}
- SourceLocation getLocEnd() const LLVM_READONLY {
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
return Kind == FieldDesignator ? getFieldLoc() : getRBracketLoc();
}
SourceRange getSourceRange() const LLVM_READONLY {
@@ -4484,8 +4550,10 @@ public:
SourceRange getDesignatorsSourceRange() const;
- SourceLocation getLocStart() const LLVM_READONLY;
- SourceLocation getLocEnd() const LLVM_READONLY;
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY;
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY;
static bool classof(const Stmt *T) {
return T->getStmtClass() == DesignatedInitExprClass;
@@ -4526,8 +4594,10 @@ public:
return T->getStmtClass() == NoInitExprClass;
}
- SourceLocation getLocStart() const LLVM_READONLY { return SourceLocation(); }
- SourceLocation getLocEnd() const LLVM_READONLY { return SourceLocation(); }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return SourceLocation(); }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return SourceLocation(); }
// Iterators
child_range children() {
@@ -4561,8 +4631,10 @@ public:
explicit DesignatedInitUpdateExpr(EmptyShell Empty)
: Expr(DesignatedInitUpdateExprClass, Empty) { }
- SourceLocation getLocStart() const LLVM_READONLY;
- SourceLocation getLocEnd() const LLVM_READONLY;
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY;
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY;
static bool classof(const Stmt *T) {
return T->getStmtClass() == DesignatedInitUpdateExprClass;
@@ -4636,10 +4708,12 @@ public:
return S->getStmtClass() == ArrayInitLoopExprClass;
}
- SourceLocation getLocStart() const LLVM_READONLY {
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY {
return getCommonExpr()->getLocStart();
}
- SourceLocation getLocEnd() const LLVM_READONLY {
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
return getCommonExpr()->getLocEnd();
}
@@ -4671,8 +4745,10 @@ public:
return S->getStmtClass() == ArrayInitIndexExprClass;
}
- SourceLocation getLocStart() const LLVM_READONLY { return SourceLocation(); }
- SourceLocation getLocEnd() const LLVM_READONLY { return SourceLocation(); }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return SourceLocation(); }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return SourceLocation(); }
child_range children() {
return child_range(child_iterator(), child_iterator());
@@ -4707,8 +4783,10 @@ public:
return T->getStmtClass() == ImplicitValueInitExprClass;
}
- SourceLocation getLocStart() const LLVM_READONLY { return SourceLocation(); }
- SourceLocation getLocEnd() const LLVM_READONLY { return SourceLocation(); }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return SourceLocation(); }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return SourceLocation(); }
// Iterators
child_range children() {
@@ -4752,8 +4830,10 @@ public:
SourceLocation getLParenLoc() const { return LParenLoc; }
SourceLocation getRParenLoc() const { return RParenLoc; }
- SourceLocation getLocStart() const LLVM_READONLY { return LParenLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return RParenLoc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return LParenLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; }
static bool classof(const Stmt *T) {
return T->getStmtClass() == ParenListExprClass;
@@ -4876,8 +4956,10 @@ public:
const Expr *getResultExpr() const { return getAssocExpr(getResultIndex()); }
Expr *getResultExpr() { return getAssocExpr(getResultIndex()); }
- SourceLocation getLocStart() const LLVM_READONLY { return GenericLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return RParenLoc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return GenericLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; }
static bool classof(const Stmt *T) {
return T->getStmtClass() == GenericSelectionExprClass;
@@ -4942,10 +5024,12 @@ public:
/// aggregate Constant of ConstantInt(s).
void getEncodedElementAccess(SmallVectorImpl<uint32_t> &Elts) const;
- SourceLocation getLocStart() const LLVM_READONLY {
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY {
return getBase()->getLocStart();
}
- SourceLocation getLocEnd() const LLVM_READONLY { return AccessorLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return AccessorLoc; }
/// isArrow - Return true if the base expression is a pointer to vector,
/// return false if the base expression is a vector.
@@ -4987,8 +5071,14 @@ public:
const Stmt *getBody() const;
Stmt *getBody();
- SourceLocation getLocStart() const LLVM_READONLY { return getCaretLocation(); }
- SourceLocation getLocEnd() const LLVM_READONLY { return getBody()->getLocEnd(); }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY {
+ return getCaretLocation();
+ }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
+ return getBody()->getLocEnd();
+ }
/// getFunctionType - Return the underlying function type for this block.
const FunctionProtoType *getFunctionType() const;
@@ -5040,8 +5130,10 @@ public:
/// getRParenLoc - Return the location of final right parenthesis.
SourceLocation getRParenLoc() const { return RParenLoc; }
- SourceLocation getLocStart() const LLVM_READONLY { return BuiltinLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return RParenLoc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return BuiltinLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; }
static bool classof(const Stmt *T) {
return T->getStmtClass() == AsTypeExprClass;
@@ -5182,10 +5274,12 @@ public:
return getSyntacticForm()->getExprLoc();
}
- SourceLocation getLocStart() const LLVM_READONLY {
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY {
return getSyntacticForm()->getLocStart();
}
- SourceLocation getLocEnd() const LLVM_READONLY {
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
return getSyntacticForm()->getLocEnd();
}
@@ -5309,8 +5403,10 @@ public:
SourceLocation getBuiltinLoc() const { return BuiltinLoc; }
SourceLocation getRParenLoc() const { return RParenLoc; }
- SourceLocation getLocStart() const LLVM_READONLY { return BuiltinLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return RParenLoc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return BuiltinLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; }
static bool classof(const Stmt *T) {
return T->getStmtClass() == AtomicExprClass;
@@ -5363,8 +5459,10 @@ public:
return const_child_range(const_child_iterator(), const_child_iterator());
}
- SourceLocation getLocStart() const LLVM_READONLY { return SourceLocation(); }
- SourceLocation getLocEnd() const LLVM_READONLY { return SourceLocation(); }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return SourceLocation(); }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return SourceLocation(); }
static bool classof(const Stmt *T) {
return T->getStmtClass() == TypoExprClass;
diff --git a/include/clang/AST/ExprCXX.h b/include/clang/AST/ExprCXX.h
index 7ab8020dec64..5ce55bde371b 100644
--- a/include/clang/AST/ExprCXX.h
+++ b/include/clang/AST/ExprCXX.h
@@ -132,8 +132,10 @@ public:
: getOperatorLoc();
}
- SourceLocation getLocStart() const LLVM_READONLY { return Range.getBegin(); }
- SourceLocation getLocEnd() const LLVM_READONLY { return Range.getEnd(); }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return Range.getBegin(); }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return Range.getEnd(); }
SourceRange getSourceRange() const { return Range; }
static bool classof(const Stmt *T) {
@@ -278,8 +280,10 @@ public:
/// Retrieve the location of the closing parenthesis.
SourceLocation getRParenLoc() const { return RParenLoc; }
- SourceLocation getLocStart() const LLVM_READONLY { return Loc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return RParenLoc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return Loc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; }
SourceRange getAngleBrackets() const LLVM_READONLY { return AngleBrackets; }
static bool classof(const Stmt *T) {
@@ -524,13 +528,15 @@ public:
return const_cast<UserDefinedLiteral*>(this)->getCookedLiteral();
}
- SourceLocation getLocStart() const {
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const {
if (getLiteralOperatorKind() == LOK_Template)
return getRParenLoc();
return getArg(0)->getLocStart();
}
- SourceLocation getLocEnd() const { return getRParenLoc(); }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const { return getRParenLoc(); }
/// Returns the location of a ud-suffix in the expression.
///
@@ -563,8 +569,10 @@ public:
bool getValue() const { return Value; }
void setValue(bool V) { Value = V; }
- SourceLocation getLocStart() const LLVM_READONLY { return Loc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return Loc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return Loc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return Loc; }
SourceLocation getLocation() const { return Loc; }
void setLocation(SourceLocation L) { Loc = L; }
@@ -594,8 +602,10 @@ public:
explicit CXXNullPtrLiteralExpr(EmptyShell Empty)
: Expr(CXXNullPtrLiteralExprClass, Empty) {}
- SourceLocation getLocStart() const LLVM_READONLY { return Loc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return Loc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return Loc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return Loc; }
SourceLocation getLocation() const { return Loc; }
void setLocation(SourceLocation L) { Loc = L; }
@@ -631,11 +641,13 @@ public:
Expr *getSubExpr() { return static_cast<Expr*>(SubExpr); }
const Expr *getSubExpr() const { return static_cast<const Expr*>(SubExpr); }
- SourceLocation getLocStart() const LLVM_READONLY {
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY {
return SubExpr->getLocStart();
}
- SourceLocation getLocEnd() const LLVM_READONLY {
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
return SubExpr->getLocEnd();
}
@@ -723,8 +735,10 @@ public:
Operand = E;
}
- SourceLocation getLocStart() const LLVM_READONLY { return Range.getBegin(); }
- SourceLocation getLocEnd() const LLVM_READONLY { return Range.getEnd(); }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return Range.getBegin(); }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return Range.getEnd(); }
SourceRange getSourceRange() const LLVM_READONLY { return Range; }
void setSourceRange(SourceRange R) { Range = R; }
@@ -778,7 +792,8 @@ public:
return getBaseExpr() && getBaseExpr()->isImplicitCXXThis();
}
- SourceLocation getLocStart() const {
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const {
if (!isImplicitAccess())
return BaseExpr->getLocStart();
else if (QualifierLoc)
@@ -787,7 +802,8 @@ public:
return MemberLoc;
}
- SourceLocation getLocEnd() const { return getMemberLoc(); }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const { return getMemberLoc(); }
child_range children() {
return child_range((Stmt**)&BaseExpr, (Stmt**)&BaseExpr + 1);
@@ -847,11 +863,13 @@ public:
Expr *getIdx() { return cast<Expr>(SubExprs[IDX_EXPR]); }
const Expr *getIdx() const { return cast<Expr>(SubExprs[IDX_EXPR]); }
- SourceLocation getLocStart() const LLVM_READONLY {
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY {
return getBase()->getLocStart();
}
- SourceLocation getLocEnd() const LLVM_READONLY { return RBracketLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return RBracketLoc; }
SourceLocation getRBracketLoc() const { return RBracketLoc; }
void setRBracketLoc(SourceLocation L) { RBracketLoc = L; }
@@ -933,8 +951,10 @@ public:
void setUuidStr(StringRef US) { UuidStr = US; }
StringRef getUuidStr() const { return UuidStr; }
- SourceLocation getLocStart() const LLVM_READONLY { return Range.getBegin(); }
- SourceLocation getLocEnd() const LLVM_READONLY { return Range.getEnd(); }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return Range.getBegin(); }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return Range.getEnd(); }
SourceRange getSourceRange() const LLVM_READONLY { return Range; }
void setSourceRange(SourceRange R) { Range = R; }
@@ -982,8 +1002,10 @@ public:
SourceLocation getLocation() const { return Loc; }
void setLocation(SourceLocation L) { Loc = L; }
- SourceLocation getLocStart() const LLVM_READONLY { return Loc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return Loc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return Loc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return Loc; }
bool isImplicit() const { return Implicit; }
void setImplicit(bool I) { Implicit = I; }
@@ -1037,9 +1059,11 @@ public:
/// this variable.
bool isThrownVariableInScope() const { return IsThrownVariableInScope; }
- SourceLocation getLocStart() const LLVM_READONLY { return ThrowLoc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return ThrowLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY {
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
if (!getSubExpr())
return ThrowLoc;
return getSubExpr()->getLocEnd();
@@ -1108,8 +1132,10 @@ public:
/// Default argument expressions have no representation in the
/// source, so they have an empty source range.
- SourceLocation getLocStart() const LLVM_READONLY { return SourceLocation(); }
- SourceLocation getLocEnd() const LLVM_READONLY { return SourceLocation(); }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return SourceLocation(); }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return SourceLocation(); }
SourceLocation getExprLoc() const LLVM_READONLY { return Loc; }
@@ -1168,8 +1194,10 @@ public:
return Field->getInClassInitializer();
}
- SourceLocation getLocStart() const LLVM_READONLY { return Loc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return Loc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return Loc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return Loc; }
static bool classof(const Stmt *T) {
return T->getStmtClass() == CXXDefaultInitExprClass;
@@ -1241,11 +1269,15 @@ public:
Expr *getSubExpr() { return cast<Expr>(SubExpr); }
void setSubExpr(Expr *E) { SubExpr = E; }
- SourceLocation getLocStart() const LLVM_READONLY {
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY {
return SubExpr->getLocStart();
}
- SourceLocation getLocEnd() const LLVM_READONLY { return SubExpr->getLocEnd();}
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
+ return SubExpr->getLocEnd();
+ }
// Implement isa/cast/dyncast/etc.
static bool classof(const Stmt *T) {
@@ -1398,8 +1430,10 @@ public:
Args[Arg] = ArgExpr;
}
- SourceLocation getLocStart() const LLVM_READONLY;
- SourceLocation getLocEnd() const LLVM_READONLY;
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY;
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY;
SourceRange getParenOrBraceRange() const { return ParenOrBraceRange; }
void setParenOrBraceRange(SourceRange Range) { ParenOrBraceRange = Range; }
@@ -1470,8 +1504,10 @@ public:
bool inheritedFromVBase() const { return InheritedFromVirtualBase; }
SourceLocation getLocation() const LLVM_READONLY { return Loc; }
- SourceLocation getLocStart() const LLVM_READONLY { return Loc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return Loc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return Loc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return Loc; }
static bool classof(const Stmt *T) {
return T->getStmtClass() == CXXInheritedCtorInitExprClass;
@@ -1533,8 +1569,10 @@ public:
/// Determine whether this expression models list-initialization.
bool isListInitialization() const { return LParenLoc.isInvalid(); }
- SourceLocation getLocStart() const LLVM_READONLY;
- SourceLocation getLocEnd() const LLVM_READONLY;
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY;
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY;
static bool classof(const Stmt *T) {
return T->getStmtClass() == CXXFunctionalCastExprClass;
@@ -1577,8 +1615,10 @@ public:
TypeSourceInfo *getTypeSourceInfo() const { return Type; }
- SourceLocation getLocStart() const LLVM_READONLY;
- SourceLocation getLocEnd() const LLVM_READONLY;
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY;
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY;
static bool classof(const Stmt *T) {
return T->getStmtClass() == CXXTemporaryObjectExprClass;
@@ -1814,11 +1854,13 @@ public:
return T->getStmtClass() == LambdaExprClass;
}
- SourceLocation getLocStart() const LLVM_READONLY {
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY {
return IntroducerRange.getBegin();
}
- SourceLocation getLocEnd() const LLVM_READONLY { return ClosingBrace; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return ClosingBrace; }
child_range children() {
// Includes initialization exprs plus body stmt
@@ -1853,8 +1895,10 @@ public:
SourceLocation getRParenLoc() const { return RParenLoc; }
- SourceLocation getLocStart() const LLVM_READONLY;
- SourceLocation getLocEnd() const LLVM_READONLY { return RParenLoc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY;
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; }
static bool classof(const Stmt *T) {
return T->getStmtClass() == CXXScalarValueInitExprClass;
@@ -2073,7 +2117,8 @@ public:
return SubExprs + Array + hasInitializer() + getNumPlacementArgs();
}
- SourceLocation getStartLoc() const { return Range.getBegin(); }
+ SourceLocation getStartLoc() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const { return Range.getBegin(); }
SourceLocation getEndLoc() const { return Range.getEnd(); }
SourceRange getDirectInitRange() const { return DirectInitRange; }
@@ -2082,7 +2127,7 @@ public:
return Range;
}
- SourceLocation getLocStart() const LLVM_READONLY { return getStartLoc(); }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
static bool classof(const Stmt *T) {
@@ -2160,8 +2205,12 @@ public:
/// be a pointer, return an invalid type.
QualType getDestroyedType() const;
- SourceLocation getLocStart() const LLVM_READONLY { return Loc; }
- SourceLocation getLocEnd() const LLVM_READONLY {return Argument->getLocEnd();}
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return Loc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
+ return Argument->getLocEnd();
+ }
static bool classof(const Stmt *T) {
return T->getStmtClass() == CXXDeleteExprClass;
@@ -2346,8 +2395,12 @@ public:
DestroyedType = PseudoDestructorTypeStorage(Info);
}
- SourceLocation getLocStart() const LLVM_READONLY {return Base->getLocStart();}
- SourceLocation getLocEnd() const LLVM_READONLY;
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY {
+ return Base->getLocStart();
+ }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY;
static bool classof(const Stmt *T) {
return T->getStmtClass() == CXXPseudoDestructorExprClass;
@@ -2428,8 +2481,10 @@ public:
getNumArgs());
}
- SourceLocation getLocStart() const LLVM_READONLY { return Loc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return RParenLoc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return Loc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; }
static bool classof(const Stmt *T) {
return T->getStmtClass() == TypeTraitExprClass;
@@ -2489,8 +2544,10 @@ public:
virtual ~ArrayTypeTraitExpr() = default;
- SourceLocation getLocStart() const LLVM_READONLY { return Loc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return RParen; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return Loc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return RParen; }
ArrayTypeTrait getTrait() const { return static_cast<ArrayTypeTrait>(ATT); }
@@ -2553,8 +2610,10 @@ public:
explicit ExpressionTraitExpr(EmptyShell Empty)
: Expr(ExpressionTraitExprClass, Empty), ET(0), Value(false) {}
- SourceLocation getLocStart() const LLVM_READONLY { return Loc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return RParen; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return Loc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return RParen; }
ExpressionTrait getTrait() const { return static_cast<ExpressionTrait>(ET); }
@@ -2845,13 +2904,15 @@ public:
/// that was looked in to find these results.
CXXRecordDecl *getNamingClass() const { return NamingClass; }
- SourceLocation getLocStart() const LLVM_READONLY {
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY {
if (NestedNameSpecifierLoc l = getQualifierLoc())
return l.getBeginLoc();
return getNameInfo().getLocStart();
}
- SourceLocation getLocEnd() const LLVM_READONLY {
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
if (hasExplicitTemplateArgs())
return getRAngleLoc();
return getNameInfo().getLocEnd();
@@ -2997,11 +3058,13 @@ public:
/// Note: getLocStart() is the start of the whole DependentScopeDeclRefExpr,
/// and differs from getLocation().getStart().
- SourceLocation getLocStart() const LLVM_READONLY {
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY {
return QualifierLoc.getBeginLoc();
}
- SourceLocation getLocEnd() const LLVM_READONLY {
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
if (hasExplicitTemplateArgs())
return getRAngleLoc();
return getLocation();
@@ -3077,11 +3140,15 @@ public:
/// when modifying an existing AST to preserve its invariants.
void setSubExpr(Expr *E) { SubExpr = E; }
- SourceLocation getLocStart() const LLVM_READONLY {
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY {
return SubExpr->getLocStart();
}
- SourceLocation getLocEnd() const LLVM_READONLY { return SubExpr->getLocEnd();}
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
+ return SubExpr->getLocEnd();
+ }
// Implement isa/cast/dyncast/etc.
static bool classof(const Stmt *T) {
@@ -3202,9 +3269,11 @@ public:
*(arg_begin() + I) = E;
}
- SourceLocation getLocStart() const LLVM_READONLY;
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY;
- SourceLocation getLocEnd() const LLVM_READONLY {
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
if (!RParenLoc.isValid() && NumArgs > 0)
return getArg(NumArgs - 1)->getLocEnd();
return RParenLoc;
@@ -3424,7 +3493,8 @@ public:
return {getTemplateArgs(), getNumTemplateArgs()};
}
- SourceLocation getLocStart() const LLVM_READONLY {
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY {
if (!isImplicitAccess())
return Base->getLocStart();
if (getQualifier())
@@ -3432,7 +3502,8 @@ public:
return MemberNameInfo.getBeginLoc();
}
- SourceLocation getLocEnd() const LLVM_READONLY {
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
if (hasExplicitTemplateArgs())
return getRAngleLoc();
return MemberNameInfo.getEndLoc();
@@ -3574,7 +3645,8 @@ public:
// diagnosing a problem with this expression.
SourceLocation getExprLoc() const LLVM_READONLY { return getMemberLoc(); }
- SourceLocation getLocStart() const LLVM_READONLY {
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY {
if (!isImplicitAccess())
return Base->getLocStart();
if (NestedNameSpecifierLoc l = getQualifierLoc())
@@ -3582,7 +3654,8 @@ public:
return getMemberNameInfo().getLocStart();
}
- SourceLocation getLocEnd() const LLVM_READONLY {
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
if (hasExplicitTemplateArgs())
return getRAngleLoc();
return getMemberNameInfo().getLocEnd();
@@ -3647,8 +3720,10 @@ public:
Expr *getOperand() const { return static_cast<Expr*>(Operand); }
- SourceLocation getLocStart() const LLVM_READONLY { return Range.getBegin(); }
- SourceLocation getLocEnd() const LLVM_READONLY { return Range.getEnd(); }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return Range.getBegin(); }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return Range.getEnd(); }
SourceRange getSourceRange() const LLVM_READONLY { return Range; }
bool getValue() const { return Value; }
@@ -3725,11 +3800,13 @@ public:
return None;
}
- SourceLocation getLocStart() const LLVM_READONLY {
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY {
return Pattern->getLocStart();
}
- SourceLocation getLocEnd() const LLVM_READONLY { return EllipsisLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return EllipsisLoc; }
static bool classof(const Stmt *T) {
return T->getStmtClass() == PackExpansionExprClass;
@@ -3849,8 +3926,10 @@ public:
return llvm::makeArrayRef(Args, Args + Length);
}
- SourceLocation getLocStart() const LLVM_READONLY { return OperatorLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return RParenLoc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return OperatorLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; }
static bool classof(const Stmt *T) {
return T->getStmtClass() == SizeOfPackExprClass;
@@ -3893,8 +3972,10 @@ public:
Param(param), Replacement(replacement), NameLoc(loc) {}
SourceLocation getNameLoc() const { return NameLoc; }
- SourceLocation getLocStart() const LLVM_READONLY { return NameLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return NameLoc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return NameLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return NameLoc; }
Expr *getReplacement() const { return cast<Expr>(Replacement); }
@@ -3957,8 +4038,10 @@ public:
/// template arguments.
TemplateArgument getArgumentPack() const;
- SourceLocation getLocStart() const LLVM_READONLY { return NameLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return NameLoc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return NameLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return NameLoc; }
static bool classof(const Stmt *T) {
return T->getStmtClass() == SubstNonTypeTemplateParmPackExprClass;
@@ -4030,8 +4113,10 @@ public:
/// Get an expansion of the parameter pack by index.
ParmVarDecl *getExpansion(unsigned I) const { return begin()[I]; }
- SourceLocation getLocStart() const LLVM_READONLY { return NameLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return NameLoc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return NameLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return NameLoc; }
static bool classof(const Stmt *T) {
return T->getStmtClass() == FunctionParmPackExprClass;
@@ -4142,11 +4227,13 @@ public:
return getValueKind() == VK_LValue;
}
- SourceLocation getLocStart() const LLVM_READONLY {
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY {
return getTemporary()->getLocStart();
}
- SourceLocation getLocEnd() const LLVM_READONLY {
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
return getTemporary()->getLocEnd();
}
@@ -4217,13 +4304,11 @@ public:
SourceLocation getEllipsisLoc() const { return EllipsisLoc; }
BinaryOperatorKind getOperator() const { return Opcode; }
- SourceLocation getLocStart() const LLVM_READONLY {
- return LParenLoc;
- }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return LParenLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY {
- return RParenLoc;
- }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; }
static bool classof(const Stmt *T) {
return T->getStmtClass() == CXXFoldExprClass;
@@ -4312,11 +4397,11 @@ public:
return static_cast<Expr*>(SubExprs[SubExpr::Resume]);
}
- SourceLocation getLocStart() const LLVM_READONLY {
- return KeywordLoc;
- }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return KeywordLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY {
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
return getCommonExpr()->getLocEnd();
}
@@ -4400,9 +4485,11 @@ public:
SourceLocation getKeywordLoc() const { return KeywordLoc; }
- SourceLocation getLocStart() const LLVM_READONLY { return KeywordLoc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return KeywordLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY {
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
return getOperand()->getLocEnd();
}
diff --git a/include/clang/AST/ExprObjC.h b/include/clang/AST/ExprObjC.h
index bb0402c27080..d02b00340663 100644
--- a/include/clang/AST/ExprObjC.h
+++ b/include/clang/AST/ExprObjC.h
@@ -67,8 +67,10 @@ public:
SourceLocation getAtLoc() const { return AtLoc; }
void setAtLoc(SourceLocation L) { AtLoc = L; }
- SourceLocation getLocStart() const LLVM_READONLY { return AtLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return String->getLocEnd(); }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return AtLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return String->getLocEnd(); }
// Iterators
child_range children() { return child_range(&String, &String+1); }
@@ -94,8 +96,10 @@ public:
bool getValue() const { return Value; }
void setValue(bool V) { Value = V; }
- SourceLocation getLocStart() const LLVM_READONLY { return Loc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return Loc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return Loc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return Loc; }
SourceLocation getLocation() const { return Loc; }
void setLocation(SourceLocation L) { Loc = L; }
@@ -141,8 +145,10 @@ public:
SourceLocation getAtLoc() const { return Range.getBegin(); }
- SourceLocation getLocStart() const LLVM_READONLY { return Range.getBegin(); }
- SourceLocation getLocEnd() const LLVM_READONLY { return Range.getEnd(); }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return Range.getBegin(); }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return Range.getEnd(); }
SourceRange getSourceRange() const LLVM_READONLY {
return Range;
@@ -194,8 +200,10 @@ public:
static ObjCArrayLiteral *CreateEmpty(const ASTContext &C,
unsigned NumElements);
- SourceLocation getLocStart() const LLVM_READONLY { return Range.getBegin(); }
- SourceLocation getLocEnd() const LLVM_READONLY { return Range.getEnd(); }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return Range.getBegin(); }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return Range.getEnd(); }
SourceRange getSourceRange() const LLVM_READONLY { return Range; }
/// Retrieve elements of array of literals.
@@ -359,8 +367,10 @@ public:
return DictWithObjectsMethod;
}
- SourceLocation getLocStart() const LLVM_READONLY { return Range.getBegin(); }
- SourceLocation getLocEnd() const LLVM_READONLY { return Range.getEnd(); }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return Range.getBegin(); }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return Range.getEnd(); }
SourceRange getSourceRange() const LLVM_READONLY { return Range; }
// Iterators
@@ -412,8 +422,10 @@ public:
EncodedType = EncType;
}
- SourceLocation getLocStart() const LLVM_READONLY { return AtLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return RParenLoc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return AtLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; }
// Iterators
child_range children() {
@@ -447,8 +459,10 @@ public:
void setAtLoc(SourceLocation L) { AtLoc = L; }
void setRParenLoc(SourceLocation L) { RParenLoc = L; }
- SourceLocation getLocStart() const LLVM_READONLY { return AtLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return RParenLoc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return AtLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; }
/// getNumArgs - Return the number of actual arguments to this call.
unsigned getNumArgs() const { return SelName.getNumArgs(); }
@@ -496,8 +510,10 @@ public:
void setAtLoc(SourceLocation L) { AtLoc = L; }
void setRParenLoc(SourceLocation L) { RParenLoc = L; }
- SourceLocation getLocStart() const LLVM_READONLY { return AtLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return RParenLoc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return AtLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; }
// Iterators
child_range children() {
@@ -556,10 +572,12 @@ public:
SourceLocation getLocation() const { return Loc; }
void setLocation(SourceLocation L) { Loc = L; }
- SourceLocation getLocStart() const LLVM_READONLY {
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY {
return isFreeIvar() ? Loc : getBase()->getLocStart();
}
- SourceLocation getLocEnd() const LLVM_READONLY { return Loc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return Loc; }
SourceLocation getOpLoc() const { return OpLoc; }
void setOpLoc(SourceLocation L) { OpLoc = L; }
@@ -742,11 +760,13 @@ public:
/// Determine the type of the base, regardless of the kind of receiver.
QualType getReceiverType(const ASTContext &ctx) const;
- SourceLocation getLocStart() const LLVM_READONLY {
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY {
return isObjectReceiver() ? getBase()->getLocStart() :getReceiverLocation();
}
- SourceLocation getLocEnd() const LLVM_READONLY { return IdLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return IdLoc; }
// Iterators
child_range children() {
@@ -838,11 +858,13 @@ public:
SourceLocation getRBracket() const { return RBracket; }
void setRBracket(SourceLocation RB) { RBracket = RB; }
- SourceLocation getLocStart() const LLVM_READONLY {
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY {
return SubExprs[BASE]->getLocStart();
}
- SourceLocation getLocEnd() const LLVM_READONLY { return RBracket; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return RBracket; }
Expr *getBaseExpr() const { return cast<Expr>(SubExprs[BASE]); }
void setBaseExpr(Stmt *S) { SubExprs[BASE] = S; }
@@ -1395,8 +1417,10 @@ public:
RBracLoc = R.getEnd();
}
- SourceLocation getLocStart() const LLVM_READONLY { return LBracLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return RBracLoc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return LBracLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return RBracLoc; }
// Iterators
child_range children();
@@ -1472,7 +1496,8 @@ public:
SourceLocation getOpLoc() const { return OpLoc; }
void setOpLoc(SourceLocation L) { OpLoc = L; }
- SourceLocation getLocStart() const LLVM_READONLY {
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY {
return getBase()->getLocStart();
}
@@ -1480,7 +1505,8 @@ public:
return getBase()->getLocEnd();
}
- SourceLocation getLocEnd() const LLVM_READONLY { return IsaMemberLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return IsaMemberLoc; }
SourceLocation getExprLoc() const LLVM_READONLY { return IsaMemberLoc; }
@@ -1549,10 +1575,14 @@ public:
child_range children() { return child_range(&Operand, &Operand+1); }
// Source locations are determined by the subexpression.
- SourceLocation getLocStart() const LLVM_READONLY {
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY {
return Operand->getLocStart();
}
- SourceLocation getLocEnd() const LLVM_READONLY { return Operand->getLocEnd();}
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
+ return Operand->getLocEnd();
+ }
SourceLocation getExprLoc() const LLVM_READONLY {
return getSubExpr()->getExprLoc();
@@ -1611,9 +1641,11 @@ public:
/// The location of the bridge keyword.
SourceLocation getBridgeKeywordLoc() const { return BridgeKeywordLoc; }
- SourceLocation getLocStart() const LLVM_READONLY { return LParenLoc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return LParenLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY {
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
return getSubExpr()->getLocEnd();
}
@@ -1651,8 +1683,10 @@ public:
explicit ObjCAvailabilityCheckExpr(EmptyShell Shell)
: Expr(ObjCAvailabilityCheckExprClass, Shell) {}
- SourceLocation getLocStart() const { return AtLoc; }
- SourceLocation getLocEnd() const { return RParen; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const { return AtLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const { return RParen; }
SourceRange getSourceRange() const { return {AtLoc, RParen}; }
/// This may be '*', in which case this should fold to true.
diff --git a/include/clang/AST/ExprOpenMP.h b/include/clang/AST/ExprOpenMP.h
index 2b4b5ec4d0e4..c8b0fff7ffa1 100644
--- a/include/clang/AST/ExprOpenMP.h
+++ b/include/clang/AST/ExprOpenMP.h
@@ -101,10 +101,12 @@ public:
/// Set length of the array section.
void setLength(Expr *E) { SubExprs[LENGTH] = E; }
- SourceLocation getLocStart() const LLVM_READONLY {
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY {
return getBase()->getLocStart();
}
- SourceLocation getLocEnd() const LLVM_READONLY { return RBracketLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return RBracketLoc; }
SourceLocation getColonLoc() const { return ColonLoc; }
void setColonLoc(SourceLocation L) { ColonLoc = L; }
diff --git a/include/clang/AST/OpenMPClause.h b/include/clang/AST/OpenMPClause.h
index 419dbe52fab6..2b34575d9f6c 100644
--- a/include/clang/AST/OpenMPClause.h
+++ b/include/clang/AST/OpenMPClause.h
@@ -64,10 +64,12 @@ protected:
public:
/// Returns the starting location of the clause.
- SourceLocation getLocStart() const { return StartLoc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const { return StartLoc; }
/// Returns the ending location of the clause.
- SourceLocation getLocEnd() const { return EndLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const { return EndLoc; }
/// Sets the starting location of the clause.
void setLocStart(SourceLocation Loc) { StartLoc = Loc; }
diff --git a/include/clang/AST/RawCommentList.h b/include/clang/AST/RawCommentList.h
index 8327efc750fd..0ab592e7c80f 100644
--- a/include/clang/AST/RawCommentList.h
+++ b/include/clang/AST/RawCommentList.h
@@ -101,8 +101,10 @@ public:
}
SourceRange getSourceRange() const LLVM_READONLY { return Range; }
- SourceLocation getLocStart() const LLVM_READONLY { return Range.getBegin(); }
- SourceLocation getLocEnd() const LLVM_READONLY { return Range.getEnd(); }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return Range.getBegin(); }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return Range.getEnd(); }
const char *getBriefText(const ASTContext &Context) const {
if (BriefTextValid)
diff --git a/include/clang/AST/Stmt.h b/include/clang/AST/Stmt.h
index aa0f88b71023..c957cccfe223 100644
--- a/include/clang/AST/Stmt.h
+++ b/include/clang/AST/Stmt.h
@@ -398,8 +398,10 @@ public:
/// value objects created/interpreted by SourceManager. We assume AST
/// clients will have a pointer to the respective SourceManager.
SourceRange getSourceRange() const LLVM_READONLY;
- SourceLocation getLocStart() const LLVM_READONLY;
- SourceLocation getLocEnd() const LLVM_READONLY;
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY;
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY;
// global temp stats (until we have a per-module visitor)
static void addStmtClass(const StmtClass s);
@@ -522,12 +524,13 @@ public:
DeclGroupRef getDeclGroup() { return DG; }
void setDeclGroup(DeclGroupRef DGR) { DG = DGR; }
- SourceLocation getStartLoc() const { return StartLoc; }
+ SourceLocation getStartLoc() const LLVM_READONLY { return getBeginLoc(); }
void setStartLoc(SourceLocation L) { StartLoc = L; }
SourceLocation getEndLoc() const { return EndLoc; }
void setEndLoc(SourceLocation L) { EndLoc = L; }
- SourceLocation getLocStart() const LLVM_READONLY { return StartLoc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return StartLoc; }
SourceLocation getLocEnd() const LLVM_READONLY { return EndLoc; }
static bool classof(const Stmt *T) {
@@ -595,8 +598,10 @@ public:
bool hasLeadingEmptyMacro() const { return HasLeadingEmptyMacro; }
- SourceLocation getLocStart() const LLVM_READONLY { return SemiLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return SemiLoc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return SemiLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return SemiLoc; }
static bool classof(const Stmt *T) {
return T->getStmtClass() == NullStmtClass;
@@ -695,8 +700,10 @@ public:
return const_reverse_body_iterator(body_begin());
}
- SourceLocation getLocStart() const LLVM_READONLY { return LBraceLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return RBraceLoc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return LBraceLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return RBraceLoc; }
SourceLocation getLBracLoc() const { return LBraceLoc; }
SourceLocation getRBracLoc() const { return RBraceLoc; }
@@ -744,8 +751,10 @@ public:
return const_cast<SwitchCase*>(this)->getSubStmt();
}
- SourceLocation getLocStart() const LLVM_READONLY { return KeywordLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY;
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return KeywordLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY;
static bool classof(const Stmt *T) {
return T->getStmtClass() == CaseStmtClass ||
@@ -797,9 +806,11 @@ public:
void setLHS(Expr *Val) { SubExprs[LHS] = reinterpret_cast<Stmt*>(Val); }
void setRHS(Expr *Val) { SubExprs[RHS] = reinterpret_cast<Stmt*>(Val); }
- SourceLocation getLocStart() const LLVM_READONLY { return KeywordLoc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return KeywordLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY {
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
// Handle deeply nested case statements with iteration instead of recursion.
const CaseStmt *CS = this;
while (const auto *CS2 = dyn_cast<CaseStmt>(CS->getSubStmt()))
@@ -838,8 +849,12 @@ public:
SourceLocation getColonLoc() const { return ColonLoc; }
void setColonLoc(SourceLocation L) { ColonLoc = L; }
- SourceLocation getLocStart() const LLVM_READONLY { return KeywordLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return SubStmt->getLocEnd();}
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return KeywordLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
+ return SubStmt->getLocEnd();
+ }
static bool classof(const Stmt *T) {
return T->getStmtClass() == DefaultStmtClass;
@@ -849,7 +864,7 @@ public:
child_range children() { return child_range(&SubStmt, &SubStmt+1); }
};
-inline SourceLocation SwitchCase::getLocEnd() const {
+inline SourceLocation SwitchCase::getEndLoc() const {
if (const auto *CS = dyn_cast<CaseStmt>(this))
return CS->getLocEnd();
return cast<DefaultStmt>(this)->getLocEnd();
@@ -882,8 +897,12 @@ public:
void setIdentLoc(SourceLocation L) { IdentLoc = L; }
void setSubStmt(Stmt *SS) { SubStmt = SS; }
- SourceLocation getLocStart() const LLVM_READONLY { return IdentLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return SubStmt->getLocEnd();}
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return IdentLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
+ return SubStmt->getLocEnd();
+ }
child_range children() { return child_range(&SubStmt, &SubStmt+1); }
@@ -937,8 +956,12 @@ public:
Stmt *getSubStmt() { return SubStmt; }
const Stmt *getSubStmt() const { return SubStmt; }
- SourceLocation getLocStart() const LLVM_READONLY { return AttrLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return SubStmt->getLocEnd();}
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return AttrLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
+ return SubStmt->getLocEnd();
+ }
child_range children() { return child_range(&SubStmt, &SubStmt + 1); }
@@ -1005,9 +1028,11 @@ public:
bool isObjCAvailabilityCheck() const;
- SourceLocation getLocStart() const LLVM_READONLY { return IfLoc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return IfLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY {
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
if (SubExprs[ELSE])
return SubExprs[ELSE]->getLocEnd();
else
@@ -1100,9 +1125,11 @@ public:
/// have been explicitly covered.
bool isAllEnumCasesCovered() const { return FirstCase.getInt(); }
- SourceLocation getLocStart() const LLVM_READONLY { return SwitchLoc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return SwitchLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY {
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
return SubExprs[BODY] ? SubExprs[BODY]->getLocEnd() : SubExprs[COND]->getLocEnd();
}
@@ -1156,9 +1183,11 @@ public:
SourceLocation getWhileLoc() const { return WhileLoc; }
void setWhileLoc(SourceLocation L) { WhileLoc = L; }
- SourceLocation getLocStart() const LLVM_READONLY { return WhileLoc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return WhileLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY {
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
return SubExprs[BODY]->getLocEnd();
}
@@ -1206,8 +1235,10 @@ public:
SourceLocation getRParenLoc() const { return RParenLoc; }
void setRParenLoc(SourceLocation L) { RParenLoc = L; }
- SourceLocation getLocStart() const LLVM_READONLY { return DoLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return RParenLoc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return DoLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; }
static bool classof(const Stmt *T) {
return T->getStmtClass() == DoStmtClass;
@@ -1276,9 +1307,11 @@ public:
SourceLocation getRParenLoc() const { return RParenLoc; }
void setRParenLoc(SourceLocation L) { RParenLoc = L; }
- SourceLocation getLocStart() const LLVM_READONLY { return ForLoc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return ForLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY {
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
return SubExprs[BODY]->getLocEnd();
}
@@ -1313,8 +1346,10 @@ public:
SourceLocation getLabelLoc() const { return LabelLoc; }
void setLabelLoc(SourceLocation L) { LabelLoc = L; }
- SourceLocation getLocStart() const LLVM_READONLY { return GotoLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return LabelLoc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return GotoLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return LabelLoc; }
static bool classof(const Stmt *T) {
return T->getStmtClass() == GotoStmtClass;
@@ -1358,8 +1393,10 @@ public:
return const_cast<IndirectGotoStmt*>(this)->getConstantTarget();
}
- SourceLocation getLocStart() const LLVM_READONLY { return GotoLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return Target->getLocEnd(); }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return GotoLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return Target->getLocEnd(); }
static bool classof(const Stmt *T) {
return T->getStmtClass() == IndirectGotoStmtClass;
@@ -1382,8 +1419,10 @@ public:
SourceLocation getContinueLoc() const { return ContinueLoc; }
void setContinueLoc(SourceLocation L) { ContinueLoc = L; }
- SourceLocation getLocStart() const LLVM_READONLY { return ContinueLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return ContinueLoc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return ContinueLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return ContinueLoc; }
static bool classof(const Stmt *T) {
return T->getStmtClass() == ContinueStmtClass;
@@ -1411,8 +1450,10 @@ public:
SourceLocation getBreakLoc() const { return BreakLoc; }
void setBreakLoc(SourceLocation L) { BreakLoc = L; }
- SourceLocation getLocStart() const LLVM_READONLY { return BreakLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return BreakLoc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return BreakLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return BreakLoc; }
static bool classof(const Stmt *T) {
return T->getStmtClass() == BreakStmtClass;
@@ -1462,9 +1503,11 @@ public:
const VarDecl *getNRVOCandidate() const { return NRVOCandidate; }
void setNRVOCandidate(const VarDecl *Var) { NRVOCandidate = Var; }
- SourceLocation getLocStart() const LLVM_READONLY { return RetLoc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return RetLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY {
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
return RetExpr ? RetExpr->getLocEnd() : RetLoc;
}
@@ -1519,8 +1562,10 @@ public:
bool isVolatile() const { return IsVolatile; }
void setVolatile(bool V) { IsVolatile = V; }
- SourceLocation getLocStart() const LLVM_READONLY { return {}; }
- SourceLocation getLocEnd() const LLVM_READONLY { return {}; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return {}; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return {}; }
//===--- Asm String Analysis ---===//
@@ -1801,8 +1846,10 @@ public:
return Clobbers[i];
}
- SourceLocation getLocStart() const LLVM_READONLY { return AsmLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return RParenLoc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return AsmLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; }
static bool classof(const Stmt *T) {
return T->getStmtClass() == GCCAsmStmtClass;
@@ -1899,8 +1946,9 @@ private:
ArrayRef<Expr*> Exprs, ArrayRef<StringRef> Clobbers);
public:
- SourceLocation getLocStart() const LLVM_READONLY { return AsmLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return EndLoc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return AsmLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
static bool classof(const Stmt *T) {
return T->getStmtClass() == MSAsmStmtClass;
@@ -1929,7 +1977,8 @@ public:
Expr *FilterExpr,
Stmt *Block);
- SourceLocation getLocStart() const LLVM_READONLY { return getExceptLoc(); }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return getExceptLoc(); }
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getExceptLoc() const { return Loc; }
@@ -1967,7 +2016,8 @@ public:
SourceLocation FinallyLoc,
Stmt *Block);
- SourceLocation getLocStart() const LLVM_READONLY { return getFinallyLoc(); }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return getFinallyLoc(); }
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getFinallyLoc() const { return Loc; }
@@ -2006,7 +2056,8 @@ public:
SourceLocation TryLoc, Stmt *TryBlock,
Stmt *Handler);
- SourceLocation getLocStart() const LLVM_READONLY { return getTryLoc(); }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return getTryLoc(); }
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getTryLoc() const { return TryLoc; }
@@ -2047,8 +2098,10 @@ public:
SourceLocation getLeaveLoc() const { return LeaveLoc; }
void setLeaveLoc(SourceLocation L) { LeaveLoc = L; }
- SourceLocation getLocStart() const LLVM_READONLY { return LeaveLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return LeaveLoc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return LeaveLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return LeaveLoc; }
static bool classof(const Stmt *T) {
return T->getStmtClass() == SEHLeaveStmtClass;
@@ -2261,11 +2314,13 @@ public:
return capture_init_begin() + NumCaptures;
}
- SourceLocation getLocStart() const LLVM_READONLY {
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY {
return getCapturedStmt()->getLocStart();
}
- SourceLocation getLocEnd() const LLVM_READONLY {
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
return getCapturedStmt()->getLocEnd();
}
diff --git a/include/clang/AST/StmtCXX.h b/include/clang/AST/StmtCXX.h
index 34553741eb38..e53203bf8a3e 100644
--- a/include/clang/AST/StmtCXX.h
+++ b/include/clang/AST/StmtCXX.h
@@ -41,8 +41,10 @@ public:
CXXCatchStmt(EmptyShell Empty)
: Stmt(CXXCatchStmtClass), ExceptionDecl(nullptr), HandlerBlock(nullptr) {}
- SourceLocation getLocStart() const LLVM_READONLY { return CatchLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY {
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return CatchLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
return HandlerBlock->getLocEnd();
}
@@ -86,7 +88,8 @@ public:
static CXXTryStmt *Create(const ASTContext &C, EmptyShell Empty,
unsigned numHandlers);
- SourceLocation getLocStart() const LLVM_READONLY { return getTryLoc(); }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return getTryLoc(); }
SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
SourceLocation getTryLoc() const { return TryLoc; }
@@ -194,8 +197,10 @@ public:
SourceLocation getColonLoc() const { return ColonLoc; }
SourceLocation getRParenLoc() const { return RParenLoc; }
- SourceLocation getLocStart() const LLVM_READONLY { return ForLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY {
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return ForLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
return SubExprs[BODY]->getLocEnd();
}
@@ -280,8 +285,12 @@ public:
return reinterpret_cast<CompoundStmt *>(SubStmt);
}
- SourceLocation getLocStart() const LLVM_READONLY { return KeywordLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return SubStmt->getLocEnd();}
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return KeywordLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
+ return SubStmt->getLocEnd();
+ }
child_range children() {
return child_range(&SubStmt, &SubStmt+1);
@@ -399,11 +408,13 @@ public:
return {getStoredStmts() + SubStmt::FirstParamMove, NumParams};
}
- SourceLocation getLocStart() const LLVM_READONLY {
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY {
return getBody() ? getBody()->getLocStart()
: getPromiseDecl()->getLocStart();
}
- SourceLocation getLocEnd() const LLVM_READONLY {
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
return getBody() ? getBody()->getLocEnd() : getPromiseDecl()->getLocEnd();
}
@@ -464,8 +475,10 @@ public:
bool isImplicit() const { return IsImplicit; }
void setIsImplicit(bool value = true) { IsImplicit = value; }
- SourceLocation getLocStart() const LLVM_READONLY { return CoreturnLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY {
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return CoreturnLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
return getOperand() ? getOperand()->getLocEnd() : getLocStart();
}
diff --git a/include/clang/AST/StmtObjC.h b/include/clang/AST/StmtObjC.h
index 0b2cc78b65be..8cb06a50b8cd 100644
--- a/include/clang/AST/StmtObjC.h
+++ b/include/clang/AST/StmtObjC.h
@@ -55,8 +55,10 @@ public:
SourceLocation getRParenLoc() const { return RParenLoc; }
void setRParenLoc(SourceLocation Loc) { RParenLoc = Loc; }
- SourceLocation getLocStart() const LLVM_READONLY { return ForLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY {
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return ForLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
return SubExprs[BODY]->getLocEnd();
}
@@ -104,8 +106,10 @@ public:
SourceLocation getRParenLoc() const { return RParenLoc; }
void setRParenLoc(SourceLocation Loc) { RParenLoc = Loc; }
- SourceLocation getLocStart() const LLVM_READONLY { return AtCatchLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return Body->getLocEnd(); }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return AtCatchLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return Body->getLocEnd(); }
bool hasEllipsis() const { return getCatchParamDecl() == nullptr; }
@@ -133,8 +137,10 @@ public:
Stmt *getFinallyBody() { return AtFinallyStmt; }
void setFinallyBody(Stmt *S) { AtFinallyStmt = S; }
- SourceLocation getLocStart() const LLVM_READONLY { return AtFinallyLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY {
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return AtFinallyLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
return AtFinallyStmt->getLocEnd();
}
@@ -238,8 +244,10 @@ public:
getStmts()[1 + NumCatchStmts] = S;
}
- SourceLocation getLocStart() const LLVM_READONLY { return AtTryLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY;
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return AtTryLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY;
static bool classof(const Stmt *T) {
return T->getStmtClass() == ObjCAtTryStmtClass;
@@ -295,8 +303,10 @@ public:
}
void setSynchExpr(Stmt *S) { SubStmts[SYNC_EXPR] = S; }
- SourceLocation getLocStart() const LLVM_READONLY { return AtSynchronizedLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY {
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return AtSynchronizedLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
return getSynchBody()->getLocEnd();
}
@@ -329,8 +339,10 @@ public:
SourceLocation getThrowLoc() const LLVM_READONLY { return AtThrowLoc; }
void setThrowLoc(SourceLocation Loc) { AtThrowLoc = Loc; }
- SourceLocation getLocStart() const LLVM_READONLY { return AtThrowLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY {
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return AtThrowLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
return Throw ? Throw->getLocEnd() : AtThrowLoc;
}
@@ -357,8 +369,12 @@ public:
Stmt *getSubStmt() { return SubStmt; }
void setSubStmt(Stmt *S) { SubStmt = S; }
- SourceLocation getLocStart() const LLVM_READONLY { return AtLoc; }
- SourceLocation getLocEnd() const LLVM_READONLY { return SubStmt->getLocEnd();}
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return AtLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY {
+ return SubStmt->getLocEnd();
+ }
SourceLocation getAtLoc() const { return AtLoc; }
void setAtLoc(SourceLocation Loc) { AtLoc = Loc; }
diff --git a/include/clang/AST/StmtOpenMP.h b/include/clang/AST/StmtOpenMP.h
index d23375e7606b..21a26b824704 100644
--- a/include/clang/AST/StmtOpenMP.h
+++ b/include/clang/AST/StmtOpenMP.h
@@ -165,9 +165,11 @@ public:
}
/// Returns starting location of directive kind.
- SourceLocation getLocStart() const { return StartLoc; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const { return StartLoc; }
/// Returns ending location of directive.
- SourceLocation getLocEnd() const { return EndLoc; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const { return EndLoc; }
/// Set starting location of directive kind.
///
diff --git a/include/clang/Analysis/CloneDetection.h b/include/clang/Analysis/CloneDetection.h
index 915ec58a5144..b3fb447b1ece 100644
--- a/include/clang/Analysis/CloneDetection.h
+++ b/include/clang/Analysis/CloneDetection.h
@@ -122,7 +122,8 @@ public:
/// Returns the start sourcelocation of the first statement in this sequence.
///
/// This method should only be called on a non-empty StmtSequence object.
- SourceLocation getStartLoc() const;
+ SourceLocation getStartLoc() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const;
/// Returns the end sourcelocation of the last statement in this sequence.
///
diff --git a/include/clang/Basic/BuiltinsX86_64.def b/include/clang/Basic/BuiltinsX86_64.def
index cc400c0697f9..a9aaadca8489 100644
--- a/include/clang/Basic/BuiltinsX86_64.def
+++ b/include/clang/Basic/BuiltinsX86_64.def
@@ -31,6 +31,8 @@ TARGET_HEADER_BUILTIN(_mul128, "LLiLLiLLiLLi*", "nch", "intrin.h", ALL_MS
TARGET_HEADER_BUILTIN(_umul128, "ULLiULLiULLiULLi*", "nch", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(__faststorefence, "v", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(__shiftleft128, "ULLiULLiULLiUc", "nch", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(__shiftright128, "ULLiULLiULLiUc", "nch", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedAnd64, "LLiLLiD*LLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
TARGET_HEADER_BUILTIN(_InterlockedDecrement64, "LLiLLiD*", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
diff --git a/include/clang/Sema/DeclSpec.h b/include/clang/Sema/DeclSpec.h
index 2e70203c6cc0..67fb98ade940 100644
--- a/include/clang/Sema/DeclSpec.h
+++ b/include/clang/Sema/DeclSpec.h
@@ -505,8 +505,10 @@ public:
const CXXScopeSpec &getTypeSpecScope() const { return TypeScope; }
SourceRange getSourceRange() const LLVM_READONLY { return Range; }
- SourceLocation getLocStart() const LLVM_READONLY { return Range.getBegin(); }
- SourceLocation getLocEnd() const LLVM_READONLY { return Range.getEnd(); }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return Range.getBegin(); }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return Range.getEnd(); }
SourceLocation getTypeSpecWidthLoc() const { return TSWRange.getBegin(); }
SourceRange getTypeSpecWidthRange() const { return TSWRange; }
@@ -1120,8 +1122,10 @@ public:
SourceRange getSourceRange() const LLVM_READONLY {
return SourceRange(StartLocation, EndLocation);
}
- SourceLocation getLocStart() const LLVM_READONLY { return StartLocation; }
- SourceLocation getLocEnd() const LLVM_READONLY { return EndLocation; }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return StartLocation; }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return EndLocation; }
};
/// A set of tokens that has been cached for later parsing.
@@ -1870,8 +1874,10 @@ public:
/// Get the source range that spans this declarator.
SourceRange getSourceRange() const LLVM_READONLY { return Range; }
- SourceLocation getLocStart() const LLVM_READONLY { return Range.getBegin(); }
- SourceLocation getLocEnd() const LLVM_READONLY { return Range.getEnd(); }
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY { return Range.getBegin(); }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return Range.getEnd(); }
void SetSourceRange(SourceRange R) { Range = R; }
/// SetRangeBegin - Set the start of the source range to Loc, unless it's
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp
index 01fd10429fc1..18ba3b13b365 100644
--- a/lib/AST/DeclObjC.cpp
+++ b/lib/AST/DeclObjC.cpp
@@ -931,7 +931,7 @@ ObjCMethodDecl *ObjCMethodDecl::getCanonicalDecl() {
return this;
}
-SourceLocation ObjCMethodDecl::getLocEnd() const {
+SourceLocation ObjCMethodDecl::getEndLoc() const {
if (Stmt *Body = getBody())
return Body->getLocEnd();
return DeclEndLoc;
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp
index 7556c76c38bd..50cff156d248 100644
--- a/lib/AST/Expr.cpp
+++ b/lib/AST/Expr.cpp
@@ -447,12 +447,12 @@ DeclRefExpr *DeclRefExpr::CreateEmpty(const ASTContext &Context,
return new (Mem) DeclRefExpr(EmptyShell());
}
-SourceLocation DeclRefExpr::getLocStart() const {
+SourceLocation DeclRefExpr::getBeginLoc() const {
if (hasQualifier())
return getQualifierLoc().getBeginLoc();
return getNameInfo().getLocStart();
}
-SourceLocation DeclRefExpr::getLocEnd() const {
+SourceLocation DeclRefExpr::getEndLoc() const {
if (hasExplicitTemplateArgs())
return getRAngleLoc();
return getNameInfo().getLocEnd();
@@ -1358,7 +1358,7 @@ QualType CallExpr::getCallReturnType(const ASTContext &Ctx) const {
return FnType->getReturnType();
}
-SourceLocation CallExpr::getLocStart() const {
+SourceLocation CallExpr::getBeginLoc() const {
if (isa<CXXOperatorCallExpr>(this))
return cast<CXXOperatorCallExpr>(this)->getLocStart();
@@ -1367,7 +1367,7 @@ SourceLocation CallExpr::getLocStart() const {
begin = getArg(0)->getLocStart();
return begin;
}
-SourceLocation CallExpr::getLocEnd() const {
+SourceLocation CallExpr::getEndLoc() const {
if (isa<CXXOperatorCallExpr>(this))
return cast<CXXOperatorCallExpr>(this)->getLocEnd();
@@ -1529,7 +1529,7 @@ MemberExpr *MemberExpr::Create(
return E;
}
-SourceLocation MemberExpr::getLocStart() const {
+SourceLocation MemberExpr::getBeginLoc() const {
if (isImplicitAccess()) {
if (hasQualifier())
return getQualifierLoc().getBeginLoc();
@@ -1543,7 +1543,7 @@ SourceLocation MemberExpr::getLocStart() const {
return BaseStartLoc;
return MemberLoc;
}
-SourceLocation MemberExpr::getLocEnd() const {
+SourceLocation MemberExpr::getEndLoc() const {
SourceLocation EndLoc = getMemberNameInfo().getEndLoc();
if (hasExplicitTemplateArgs())
EndLoc = getRAngleLoc();
@@ -2039,7 +2039,7 @@ bool InitListExpr::isIdiomaticZeroInitializer(const LangOptions &LangOpts) const
return Lit && Lit->getValue() == 0;
}
-SourceLocation InitListExpr::getLocStart() const {
+SourceLocation InitListExpr::getBeginLoc() const {
if (InitListExpr *SyntacticForm = getSyntacticForm())
return SyntacticForm->getLocStart();
SourceLocation Beg = LBraceLoc;
@@ -2057,7 +2057,7 @@ SourceLocation InitListExpr::getLocStart() const {
return Beg;
}
-SourceLocation InitListExpr::getLocEnd() const {
+SourceLocation InitListExpr::getEndLoc() const {
if (InitListExpr *SyntacticForm = getSyntacticForm())
return SyntacticForm->getLocEnd();
SourceLocation End = RBraceLoc;
@@ -3870,7 +3870,7 @@ SourceRange DesignatedInitExpr::getDesignatorsSourceRange() const {
DIE->getDesignator(size()-1)->getLocEnd());
}
-SourceLocation DesignatedInitExpr::getLocStart() const {
+SourceLocation DesignatedInitExpr::getBeginLoc() const {
SourceLocation StartLoc;
auto *DIE = const_cast<DesignatedInitExpr *>(this);
Designator &First = *DIE->getDesignator(0);
@@ -3885,7 +3885,7 @@ SourceLocation DesignatedInitExpr::getLocStart() const {
return StartLoc;
}
-SourceLocation DesignatedInitExpr::getLocEnd() const {
+SourceLocation DesignatedInitExpr::getEndLoc() const {
return getInit()->getLocEnd();
}
@@ -3944,11 +3944,11 @@ DesignatedInitUpdateExpr::DesignatedInitUpdateExpr(const ASTContext &C,
BaseAndUpdaterExprs[1] = ILE;
}
-SourceLocation DesignatedInitUpdateExpr::getLocStart() const {
+SourceLocation DesignatedInitUpdateExpr::getBeginLoc() const {
return getBase()->getLocStart();
}
-SourceLocation DesignatedInitUpdateExpr::getLocEnd() const {
+SourceLocation DesignatedInitUpdateExpr::getEndLoc() const {
return getBase()->getLocEnd();
}
diff --git a/lib/AST/ExprCXX.cpp b/lib/AST/ExprCXX.cpp
index 93d68ec8e0b2..cc4c631553be 100644
--- a/lib/AST/ExprCXX.cpp
+++ b/lib/AST/ExprCXX.cpp
@@ -89,7 +89,7 @@ QualType CXXUuidofExpr::getTypeOperand(ASTContext &Context) const {
}
// CXXScalarValueInitExpr
-SourceLocation CXXScalarValueInitExpr::getLocStart() const {
+SourceLocation CXXScalarValueInitExpr::getBeginLoc() const {
return TypeInfo ? TypeInfo->getTypeLoc().getBeginLoc() : RParenLoc;
}
@@ -250,7 +250,7 @@ QualType CXXPseudoDestructorExpr::getDestroyedType() const {
return QualType();
}
-SourceLocation CXXPseudoDestructorExpr::getLocEnd() const {
+SourceLocation CXXPseudoDestructorExpr::getEndLoc() const {
SourceLocation End = DestroyedType.getLocation();
if (TypeSourceInfo *TInfo = DestroyedType.getTypeSourceInfo())
End = TInfo->getTypeLoc().getLocalSourceRange().getEnd();
@@ -450,13 +450,13 @@ DependentScopeDeclRefExpr::CreateEmpty(const ASTContext &C,
return E;
}
-SourceLocation CXXConstructExpr::getLocStart() const {
+SourceLocation CXXConstructExpr::getBeginLoc() const {
if (isa<CXXTemporaryObjectExpr>(this))
return cast<CXXTemporaryObjectExpr>(this)->getLocStart();
return Loc;
}
-SourceLocation CXXConstructExpr::getLocEnd() const {
+SourceLocation CXXConstructExpr::getEndLoc() const {
if (isa<CXXTemporaryObjectExpr>(this))
return cast<CXXTemporaryObjectExpr>(this)->getLocEnd();
@@ -707,11 +707,11 @@ CXXFunctionalCastExpr::CreateEmpty(const ASTContext &C, unsigned PathSize) {
return new (Buffer) CXXFunctionalCastExpr(EmptyShell(), PathSize);
}
-SourceLocation CXXFunctionalCastExpr::getLocStart() const {
+SourceLocation CXXFunctionalCastExpr::getBeginLoc() const {
return getTypeInfoAsWritten()->getTypeLoc().getLocStart();
}
-SourceLocation CXXFunctionalCastExpr::getLocEnd() const {
+SourceLocation CXXFunctionalCastExpr::getEndLoc() const {
return RParenLoc.isValid() ? RParenLoc : getSubExpr()->getLocEnd();
}
@@ -792,11 +792,11 @@ CXXTemporaryObjectExpr::CXXTemporaryObjectExpr(const ASTContext &C,
CXXConstructExpr::CK_Complete, ParenOrBraceRange),
Type(TSI) {}
-SourceLocation CXXTemporaryObjectExpr::getLocStart() const {
+SourceLocation CXXTemporaryObjectExpr::getBeginLoc() const {
return Type->getTypeLoc().getBeginLoc();
}
-SourceLocation CXXTemporaryObjectExpr::getLocEnd() const {
+SourceLocation CXXTemporaryObjectExpr::getEndLoc() const {
SourceLocation Loc = getParenOrBraceRange().getEnd();
if (Loc.isInvalid() && getNumArgs())
Loc = getArg(getNumArgs()-1)->getLocEnd();
@@ -1120,7 +1120,7 @@ CXXUnresolvedConstructExpr::CreateEmpty(const ASTContext &C, unsigned NumArgs) {
return new (Mem) CXXUnresolvedConstructExpr(Empty, NumArgs);
}
-SourceLocation CXXUnresolvedConstructExpr::getLocStart() const {
+SourceLocation CXXUnresolvedConstructExpr::getBeginLoc() const {
return Type->getTypeLoc().getBeginLoc();
}
diff --git a/lib/AST/MicrosoftMangle.cpp b/lib/AST/MicrosoftMangle.cpp
index 40281481f1d1..d5332ba7db54 100644
--- a/lib/AST/MicrosoftMangle.cpp
+++ b/lib/AST/MicrosoftMangle.cpp
@@ -29,6 +29,7 @@
#include "clang/Basic/TargetInfo.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/JamCRC.h"
+#include "llvm/Support/xxhash.h"
#include "llvm/Support/MD5.h"
#include "llvm/Support/MathExtras.h"
@@ -127,10 +128,10 @@ class MicrosoftMangleContextImpl : public MicrosoftMangleContext {
llvm::DenseMap<const CXXRecordDecl *, unsigned> LambdaIds;
llvm::DenseMap<const NamedDecl *, unsigned> SEHFilterIds;
llvm::DenseMap<const NamedDecl *, unsigned> SEHFinallyIds;
+ SmallString<16> AnonymousNamespaceHash;
public:
- MicrosoftMangleContextImpl(ASTContext &Context, DiagnosticsEngine &Diags)
- : MicrosoftMangleContext(Context, Diags) {}
+ MicrosoftMangleContextImpl(ASTContext &Context, DiagnosticsEngine &Diags);
bool shouldMangleCXXName(const NamedDecl *D) override;
bool shouldMangleStringLiteral(const StringLiteral *SL) override;
void mangleCXXName(const NamedDecl *D, raw_ostream &Out) override;
@@ -238,6 +239,12 @@ public:
return Result.first->second;
}
+ /// Return a character sequence that is (somewhat) unique to the TU suitable
+ /// for mangling anonymous namespaces.
+ StringRef getAnonymousNamespaceHash() const {
+ return AnonymousNamespaceHash;
+ }
+
private:
void mangleInitFiniStub(const VarDecl *D, char CharCode, raw_ostream &Out);
};
@@ -371,6 +378,34 @@ private:
};
}
+MicrosoftMangleContextImpl::MicrosoftMangleContextImpl(ASTContext &Context,
+ DiagnosticsEngine &Diags)
+ : MicrosoftMangleContext(Context, Diags) {
+ // To mangle anonymous namespaces, hash the path to the main source file. The
+ // path should be whatever (probably relative) path was passed on the command
+ // line. The goal is for the compiler to produce the same output regardless of
+ // working directory, so use the uncanonicalized relative path.
+ //
+ // It's important to make the mangled names unique because, when CodeView
+ // debug info is in use, the debugger uses mangled type names to distinguish
+ // between otherwise identically named types in anonymous namespaces.
+ //
+ // These symbols are always internal, so there is no need for the hash to
+ // match what MSVC produces. For the same reason, clang is free to change the
+ // hash at any time without breaking compatibility with old versions of clang.
+ // The generated names are intended to look similar to what MSVC generates,
+ // which are something like "?A0x01234567@".
+ SourceManager &SM = Context.getSourceManager();
+ if (const FileEntry *FE = SM.getFileEntryForID(SM.getMainFileID())) {
+ // Truncate the hash so we get 8 characters of hexadecimal.
+ uint32_t TruncatedHash = uint32_t(xxHash64(FE->getName()));
+ AnonymousNamespaceHash = llvm::utohexstr(TruncatedHash);
+ } else {
+ // If we don't have a path to the main file, we'll just use 0.
+ AnonymousNamespaceHash = "0";
+ }
+}
+
bool MicrosoftMangleContextImpl::shouldMangleCXXName(const NamedDecl *D) {
if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
LanguageLinkage L = FD->getLanguageLinkage();
@@ -785,7 +820,7 @@ void MicrosoftCXXNameMangler::mangleUnqualifiedName(const NamedDecl *ND,
if (const NamespaceDecl *NS = dyn_cast<NamespaceDecl>(ND)) {
if (NS->isAnonymousNamespace()) {
- Out << "?A@";
+ Out << "?A0x" << Context.getAnonymousNamespaceHash() << '@';
break;
}
}
@@ -905,8 +940,14 @@ void MicrosoftCXXNameMangler::mangleUnqualifiedName(const NamedDecl *ND,
case DeclarationName::ObjCZeroArgSelector:
case DeclarationName::ObjCOneArgSelector:
- case DeclarationName::ObjCMultiArgSelector:
- llvm_unreachable("Can't mangle Objective-C selector names here!");
+ case DeclarationName::ObjCMultiArgSelector: {
+ // This is reachable only when constructing an outlined SEH finally
+ // block. Nothing depends on this mangling and it's used only with
+ // functinos with internal linkage.
+ llvm::SmallString<64> Name;
+ mangleSourceName(Name.str());
+ break;
+ }
case DeclarationName::CXXConstructorName:
if (isStructorDecl(ND)) {
diff --git a/lib/AST/Stmt.cpp b/lib/AST/Stmt.cpp
index a041006c905e..64a7a196140e 100644
--- a/lib/AST/Stmt.cpp
+++ b/lib/AST/Stmt.cpp
@@ -275,8 +275,8 @@ SourceRange Stmt::getSourceRange() const {
llvm_unreachable("unknown statement kind!");
}
-SourceLocation Stmt::getLocStart() const {
-// llvm::errs() << "getLocStart() for " << getStmtClassName() << "\n";
+SourceLocation Stmt::getBeginLoc() const {
+ // llvm::errs() << "getBeginLoc() for " << getStmtClassName() << "\n";
switch (getStmtClass()) {
case Stmt::NoStmtClass: llvm_unreachable("statement without class");
#define ABSTRACT_STMT(type)
@@ -288,7 +288,7 @@ SourceLocation Stmt::getLocStart() const {
llvm_unreachable("unknown statement kind");
}
-SourceLocation Stmt::getLocEnd() const {
+SourceLocation Stmt::getEndLoc() const {
switch (getStmtClass()) {
case Stmt::NoStmtClass: llvm_unreachable("statement without class");
#define ABSTRACT_STMT(type)
diff --git a/lib/AST/StmtObjC.cpp b/lib/AST/StmtObjC.cpp
index eea03f64c2fe..cc4b2308a08b 100644
--- a/lib/AST/StmtObjC.cpp
+++ b/lib/AST/StmtObjC.cpp
@@ -64,7 +64,7 @@ ObjCAtTryStmt *ObjCAtTryStmt::CreateEmpty(const ASTContext &Context,
return new (Mem) ObjCAtTryStmt(EmptyShell(), NumCatchStmts, HasFinally);
}
-SourceLocation ObjCAtTryStmt::getLocEnd() const {
+SourceLocation ObjCAtTryStmt::getEndLoc() const {
if (HasFinally)
return getFinallyStmt()->getLocEnd();
if (NumCatchStmts)
diff --git a/lib/Analysis/CloneDetection.cpp b/lib/Analysis/CloneDetection.cpp
index 8912b3b76751..c0b9b5c0823a 100644
--- a/lib/Analysis/CloneDetection.cpp
+++ b/lib/Analysis/CloneDetection.cpp
@@ -77,7 +77,7 @@ ASTContext &StmtSequence::getASTContext() const {
return D->getASTContext();
}
-SourceLocation StmtSequence::getStartLoc() const {
+SourceLocation StmtSequence::getBeginLoc() const {
return front()->getLocStart();
}
diff --git a/lib/Basic/Targets/X86.h b/lib/Basic/Targets/X86.h
index 019bc8d51a63..1d23b0ef6933 100644
--- a/lib/Basic/Targets/X86.h
+++ b/lib/Basic/Targets/X86.h
@@ -350,11 +350,9 @@ public:
(1 << TargetInfo::LongDouble));
// x86-32 has atomics up to 8 bytes
- CPUKind Kind = getCPUKind(Opts.CPU);
- if (Kind >= CK_i586 || Kind == CK_Generic)
- MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64;
- else if (Kind >= CK_i486)
- MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 32;
+ // FIXME: Check that we actually have cmpxchg8b before setting
+ // MaxAtomicInlineWidth. (cmpxchg8b is an i586 instruction.)
+ MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64;
}
BuiltinVaListKind getBuiltinVaListKind() const override {
diff --git a/lib/CodeGen/CGBuiltin.cpp b/lib/CodeGen/CGBuiltin.cpp
index e99121c46d9b..669a3be0e6e1 100644
--- a/lib/CodeGen/CGBuiltin.cpp
+++ b/lib/CodeGen/CGBuiltin.cpp
@@ -10361,6 +10361,27 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned BuiltinID,
return Builder.CreateFence(llvm::AtomicOrdering::SequentiallyConsistent,
llvm::SyncScope::System);
}
+ case X86::BI__shiftleft128:
+ case X86::BI__shiftright128: {
+ // FIXME: Once fshl/fshr no longer add an unneeded and and cmov, do this:
+ // llvm::Function *F = CGM.getIntrinsic(
+ // BuiltinID == X86::BI__shiftleft128 ? Intrinsic::fshl : Intrinsic::fshr,
+ // Int64Ty);
+ // Ops[2] = Builder.CreateZExt(Ops[2], Int64Ty);
+ // return Builder.CreateCall(F, Ops);
+ llvm::Type *Int128Ty = Builder.getInt128Ty();
+ Value *Val = Builder.CreateOr(
+ Builder.CreateShl(Builder.CreateZExt(Ops[1], Int128Ty), 64),
+ Builder.CreateZExt(Ops[0], Int128Ty));
+ Value *Amt = Builder.CreateAnd(Builder.CreateZExt(Ops[2], Int128Ty),
+ llvm::ConstantInt::get(Int128Ty, 0x3f));
+ Value *Res;
+ if (BuiltinID == X86::BI__shiftleft128)
+ Res = Builder.CreateLShr(Builder.CreateShl(Val, Amt), 64);
+ else
+ Res = Builder.CreateLShr(Val, Amt);
+ return Builder.CreateTrunc(Res, Int64Ty);
+ }
case X86::BI_ReadWriteBarrier:
case X86::BI_ReadBarrier:
case X86::BI_WriteBarrier: {
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp
index f168dd02ead1..93a1859de720 100644
--- a/lib/CodeGen/CGExpr.cpp
+++ b/lib/CodeGen/CGExpr.cpp
@@ -2408,6 +2408,7 @@ LValue CodeGenFunction::EmitDeclRefLValue(const DeclRefExpr *E) {
// A DeclRefExpr for a reference initialized by a constant expression can
// appear without being odr-used. Directly emit the constant initializer.
const Expr *Init = VD->getAnyInitializer(VD);
+ const auto *BD = dyn_cast_or_null<BlockDecl>(CurCodeDecl);
if (Init && !isa<ParmVarDecl>(VD) && VD->getType()->isReferenceType() &&
VD->isUsableInConstantExpressions(getContext()) &&
VD->checkInitIsICE() &&
@@ -2417,7 +2418,7 @@ LValue CodeGenFunction::EmitDeclRefLValue(const DeclRefExpr *E) {
(LocalDeclMap.count(VD->getCanonicalDecl()) ||
CapturedStmtInfo->lookup(VD->getCanonicalDecl()))) ||
LambdaCaptureFields.lookup(VD->getCanonicalDecl()) ||
- isa<BlockDecl>(CurCodeDecl)))) {
+ (BD && BD->capturesVariable(VD))))) {
llvm::Constant *Val =
ConstantEmitter(*this).emitAbstract(E->getLocation(),
*VD->evaluateValue(),
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp
index 8c5e0df0969b..155ee6c6af12 100644
--- a/lib/CodeGen/CodeGenModule.cpp
+++ b/lib/CodeGen/CodeGenModule.cpp
@@ -2539,15 +2539,17 @@ llvm::Constant *CodeGenModule::GetOrCreateLLVMFunction(
if (getLangOpts().OpenMPIsDevice && OpenMPRuntime &&
!OpenMPRuntime->markAsGlobalTarget(GD) && FD->isDefined() &&
!DontDefer && !IsForDefinition) {
- const FunctionDecl *FDDef = FD->getDefinition();
- GlobalDecl GDDef;
- if (const auto *CD = dyn_cast<CXXConstructorDecl>(FDDef))
- GDDef = GlobalDecl(CD, GD.getCtorType());
- else if (const auto *DD = dyn_cast<CXXDestructorDecl>(FDDef))
- GDDef = GlobalDecl(DD, GD.getDtorType());
- else
- GDDef = GlobalDecl(FDDef);
- addDeferredDeclToEmit(GDDef);
+ if (const FunctionDecl *FDDef = FD->getDefinition())
+ if (getContext().DeclMustBeEmitted(FDDef)) {
+ GlobalDecl GDDef;
+ if (const auto *CD = dyn_cast<CXXConstructorDecl>(FDDef))
+ GDDef = GlobalDecl(CD, GD.getCtorType());
+ else if (const auto *DD = dyn_cast<CXXDestructorDecl>(FDDef))
+ GDDef = GlobalDecl(DD, GD.getDtorType());
+ else
+ GDDef = GlobalDecl(FDDef);
+ addDeferredDeclToEmit(GDDef);
+ }
}
if (FD->isMultiVersion()) {
diff --git a/lib/CodeGen/CoverageMappingGen.cpp b/lib/CodeGen/CoverageMappingGen.cpp
index 2d8446463594..389d29e467b7 100644
--- a/lib/CodeGen/CoverageMappingGen.cpp
+++ b/lib/CodeGen/CoverageMappingGen.cpp
@@ -67,7 +67,8 @@ public:
void setStartLoc(SourceLocation Loc) { LocStart = Loc; }
- SourceLocation getStartLoc() const {
+ SourceLocation getStartLoc() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const {
assert(LocStart && "Region has no start location");
return *LocStart;
}
diff --git a/lib/Headers/intrin.h b/lib/Headers/intrin.h
index 91914214e299..edb947eef659 100644
--- a/lib/Headers/intrin.h
+++ b/lib/Headers/intrin.h
@@ -863,20 +863,6 @@ __nop(void) {
__asm__ volatile ("nop");
}
#endif
-#if defined(__x86_64__)
-static __inline__ unsigned __int64 __DEFAULT_FN_ATTRS
-__shiftleft128(unsigned __int64 __l, unsigned __int64 __h, unsigned char __d) {
- unsigned __int128 __val = ((unsigned __int128)__h << 64) | __l;
- unsigned __int128 __res = __val << (__d & 63);
- return (unsigned __int64)(__res >> 64);
-}
-static __inline__ unsigned __int64 __DEFAULT_FN_ATTRS
-__shiftright128(unsigned __int64 __l, unsigned __int64 __h, unsigned char __d) {
- unsigned __int128 __val = ((unsigned __int128)__h << 64) | __l;
- unsigned __int128 __res = __val >> (__d & 63);
- return (unsigned __int64)__res;
-}
-#endif
/*----------------------------------------------------------------------------*\
|* Privileged intrinsics
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp
index 93dbeab5b034..718a5e1ccefa 100644
--- a/lib/Sema/SemaChecking.cpp
+++ b/lib/Sema/SemaChecking.cpp
@@ -6121,11 +6121,13 @@ class FormatStringLiteral {
StartToken, StartTokenByteOffset);
}
- SourceLocation getLocStart() const LLVM_READONLY {
+ SourceLocation getLocStart() const LLVM_READONLY { return getBeginLoc(); }
+ SourceLocation getBeginLoc() const LLVM_READONLY {
return FExpr->getLocStart().getLocWithOffset(Offset);
}
- SourceLocation getLocEnd() const LLVM_READONLY { return FExpr->getLocEnd(); }
+ SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
+ SourceLocation getEndLoc() const LLVM_READONLY { return FExpr->getLocEnd(); }
};
} // namespace
diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp
index 01ef86c656bb..5070996d50e0 100644
--- a/lib/Sema/SemaInit.cpp
+++ b/lib/Sema/SemaInit.cpp
@@ -6942,6 +6942,10 @@ void Sema::checkInitializerLifetime(const InitializedEntity &Entity,
} else if (isa<BlockExpr>(L)) {
Diag(DiagLoc, diag::err_ret_local_block) << DiagRange;
} else if (isa<AddrLabelExpr>(L)) {
+ // Don't warn when returning a label from a statement expression.
+ // Leaving the scope doesn't end its lifetime.
+ if (LK == LK_StmtExprResult)
+ return false;
Diag(DiagLoc, diag::warn_ret_addr_label) << DiagRange;
} else {
Diag(DiagLoc, diag::warn_ret_local_temp_addr_ref)
diff --git a/test/CodeGen/ms-x86-intrinsics.c b/test/CodeGen/ms-x86-intrinsics.c
index 450a134131be..bd8f5fce237a 100644
--- a/test/CodeGen/ms-x86-intrinsics.c
+++ b/test/CodeGen/ms-x86-intrinsics.c
@@ -130,4 +130,34 @@ unsigned __int64 test_umul128(unsigned __int64 Multiplier,
// CHECK-X64: = mul nuw i128 %
// CHECK-X64: store i64 %
// CHECK-X64: ret i64 %
-#endif
+
+unsigned __int64 test__shiftleft128(unsigned __int64 l, unsigned __int64 h,
+ unsigned char d) {
+ return __shiftleft128(l, h, d);
+}
+// CHECK-X64-LABEL: define dso_local i64 @test__shiftleft128(i64 %l, i64 %h, i8 %d)
+// CHECK-X64 = zext i64 %h to i128
+// CHECK-X64 = shl nuw i128 %0, 64
+// CHECK-X64 = zext i64 %l to i128
+// CHECK-X64 = or i128 %1, %2
+// CHECK-X64 = and i8 %d, 63
+// CHECK-X64 = shl i128 %
+// CHECK-X64 = lshr i128 %
+// CHECK-X64 = trunc i128 %
+// CHECK-X64 ret i64 %
+
+unsigned __int64 test__shiftright128(unsigned __int64 l, unsigned __int64 h,
+ unsigned char d) {
+ return __shiftright128(l, h, d);
+}
+// CHECK-X64-LABEL: define dso_local i64 @test__shiftright128(i64 %l, i64 %h, i8 %d)
+// CHECK-X64 = zext i64 %h to i128
+// CHECK-X64 = shl nuw i128 %
+// CHECK-X64 = zext i64 %l to i128
+// CHECK-X64 = or i128 %
+// CHECK-X64 = and i8 %d, 63
+// CHECK-X64 = lshr i128 %
+// CHECK-X64 = trunc i128 %
+// CHECK-X64 ret i64 %
+
+#endif // defined(__x86_64__)
diff --git a/test/CodeGenCXX/atomic-inline.cpp b/test/CodeGenCXX/atomic-inline.cpp
index 327f85d5667f..fe727589d2e2 100644
--- a/test/CodeGenCXX/atomic-inline.cpp
+++ b/test/CodeGenCXX/atomic-inline.cpp
@@ -1,52 +1,6 @@
// RUN: %clang_cc1 %s -std=c++11 -emit-llvm -o - -triple=x86_64-linux-gnu | FileCheck %s
// RUN: %clang_cc1 %s -std=c++11 -emit-llvm -o - -triple=x86_64-linux-gnu -target-cpu core2 | FileCheck %s --check-prefix=CORE2
-// RUN: %clang_cc1 %s -std=c++11 -emit-llvm -o - -triple=i386-linux-gnu -target-cpu i386 | FileCheck %s --check-prefix=I386
-// RUN: %clang_cc1 %s -std=c++11 -emit-llvm -o - -triple=i386-linux-gnu -target-cpu i486 | FileCheck %s --check-prefix=I486
-// Check the atomic code generation for cpu targets w/wo cx, cx8 and cx16 support.
-
-struct alignas(4) AM4 {
- short f1, f2;
-};
-AM4 m4;
-AM4 load4() {
- AM4 am;
- // CHECK-LABEL: @_Z5load4v
- // CHECK: load atomic i32, {{.*}} monotonic
- // CORE2-LABEL: @_Z5load4v
- // CORE2: load atomic i32, {{.*}} monotonic
- // I386-LABEL: @_Z5load4v
- // I386: call i32 @__atomic_load_4
- // I486-LABEL: @_Z5load4v
- // I486: load atomic i32, {{.*}} monotonic
- __atomic_load(&m4, &am, 0);
- return am;
-}
-
-AM4 s4;
-void store4() {
- // CHECK-LABEL: @_Z6store4v
- // CHECK: store atomic i32 {{.*}} monotonic
- // CORE2-LABEL: @_Z6store4v
- // CORE2: store atomic i32 {{.*}} monotonic
- // I386-LABEL: @_Z6store4v
- // I386: call void @__atomic_store_4
- // I486-LABEL: @_Z6store4v
- // I486: store atomic i32 {{.*}} monotonic
- __atomic_store(&m4, &s4, 0);
-}
-
-bool cmpxchg4() {
- AM4 am;
- // CHECK-LABEL: @_Z8cmpxchg4v
- // CHECK: cmpxchg i32* {{.*}} monotonic
- // CORE2-LABEL: @_Z8cmpxchg4v
- // CORE2: cmpxchg i32* {{.*}} monotonic
- // I386-LABEL: @_Z8cmpxchg4v
- // I386: call zeroext i1 @__atomic_compare_exchange_4
- // I486-LABEL: @_Z8cmpxchg4v
- // I486: cmpxchg i32* {{.*}} monotonic
- return __atomic_compare_exchange(&m4, &s4, &am, 0, 0, 0);
-}
+// Check the atomic code generation for cpu targets w/wo cx16 support.
struct alignas(8) AM8 {
int f1, f2;
@@ -58,10 +12,6 @@ AM8 load8() {
// CHECK: load atomic i64, {{.*}} monotonic
// CORE2-LABEL: @_Z5load8v
// CORE2: load atomic i64, {{.*}} monotonic
- // I386-LABEL: @_Z5load8v
- // I386: call i64 @__atomic_load_8
- // I486-LABEL: @_Z5load8v
- // I486: call i64 @__atomic_load_8
__atomic_load(&m8, &am, 0);
return am;
}
@@ -72,10 +22,6 @@ void store8() {
// CHECK: store atomic i64 {{.*}} monotonic
// CORE2-LABEL: @_Z6store8v
// CORE2: store atomic i64 {{.*}} monotonic
- // I386-LABEL: @_Z6store8v
- // I386: call void @__atomic_store_8
- // I486-LABEL: @_Z6store8v
- // I486: call void @__atomic_store_8
__atomic_store(&m8, &s8, 0);
}
@@ -85,10 +31,6 @@ bool cmpxchg8() {
// CHECK: cmpxchg i64* {{.*}} monotonic
// CORE2-LABEL: @_Z8cmpxchg8v
// CORE2: cmpxchg i64* {{.*}} monotonic
- // I386-LABEL: @_Z8cmpxchg8v
- // I386: call zeroext i1 @__atomic_compare_exchange_8
- // I486-LABEL: @_Z8cmpxchg8v
- // I486: call zeroext i1 @__atomic_compare_exchange_8
return __atomic_compare_exchange(&m8, &s8, &am, 0, 0, 0);
}
@@ -124,3 +66,4 @@ bool cmpxchg16() {
// CORE2: cmpxchg i128* {{.*}} monotonic
return __atomic_compare_exchange(&m16, &s16, &am, 0, 0, 0);
}
+
diff --git a/test/CodeGenCXX/block-byref.cpp b/test/CodeGenCXX/block-byref.cpp
new file mode 100644
index 000000000000..1cb86a547573
--- /dev/null
+++ b/test/CodeGenCXX/block-byref.cpp
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 %s -fblocks -triple x86_64-apple-darwin -std=c++11 -emit-llvm -o - | FileCheck %s
+// REQUIRES: x86-registered-target
+
+// CHECK: @b = global i32 0,
+
+// CHECK: define {{.*}}void @{{.*}}test{{.*}}_block_invoke(
+// CHECK: store i32 2, i32* @b,
+// CHECK: ret void
+
+int b;
+
+void test() {
+ int &a = b;
+ ^{ a = 2; };
+}
diff --git a/test/CodeGenCXX/cfi-cross-dso.cpp b/test/CodeGenCXX/cfi-cross-dso.cpp
index 6d5e0591191c..4b7b3d70f098 100644
--- a/test/CodeGenCXX/cfi-cross-dso.cpp
+++ b/test/CodeGenCXX/cfi-cross-dso.cpp
@@ -26,7 +26,7 @@ void g() {
b.f();
}
-// MS: @[[B_VTABLE:.*]] = private unnamed_addr constant { [2 x i8*] } {{.*}}@"??_R4B@?A@@6B@"{{.*}}@"?f@B@?A@@UEAAXXZ"
+// MS: @[[B_VTABLE:.*]] = private unnamed_addr constant { [2 x i8*] } {{.*}}@"??_R4B@?A0x{{[^@]*}}@@6B@"{{.*}}@"?f@B@?A0x{{[^@]*}}@@UEAAXXZ"
// CHECK: %[[VT:.*]] = load void (%struct.A*)**, void (%struct.A*)***
// CHECK: %[[VT2:.*]] = bitcast {{.*}}%[[VT]] to i8*, !nosanitize
diff --git a/test/CodeGenCXX/cfi-icall.cpp b/test/CodeGenCXX/cfi-icall.cpp
index e53aeefd8a9b..00c9f59700ac 100644
--- a/test/CodeGenCXX/cfi-icall.cpp
+++ b/test/CodeGenCXX/cfi-icall.cpp
@@ -21,7 +21,7 @@ void g() {
}
// ITANIUM: define internal void @_ZN12_GLOBAL__N_11fENS_1SE({{.*}} !type [[TS1:![0-9]+]] !type [[TS2:![0-9]+]]
-// MS: define internal void @"?f@?A@@YAXUS@?A@@@Z"({{.*}} !type [[TS1:![0-9]+]] !type [[TS2:![0-9]+]]
+// MS: define internal void @"?f@?A0x{{[^@]*}}@@YAXUS@?A0x{{[^@]*}}@@@Z"({{.*}} !type [[TS1:![0-9]+]] !type [[TS2:![0-9]+]]
// CHECK: [[VOIDS1]] = distinct !{}
// CHECK: [[TS1]] = !{i64 0, [[VOIDS1]]}
diff --git a/test/CodeGenCXX/debug-info-thunk.cpp b/test/CodeGenCXX/debug-info-thunk.cpp
index 56dec93f6b39..27bbbc683277 100644
--- a/test/CodeGenCXX/debug-info-thunk.cpp
+++ b/test/CodeGenCXX/debug-info-thunk.cpp
@@ -86,7 +86,7 @@ namespace Test4 {
};
}
void C::c() {}
-// CHECK-DAG: DISubprogram{{.*}}linkageName: "?f@C@?A@Test4@@W7EAAXXZ"{{.*}} flags: {{.*}}DIFlagThunk
+// CHECK-DAG: DISubprogram{{.*}}linkageName: "?f@C@?A0x{{[^@]*}}@Test4@@W7EAAXXZ"{{.*}} flags: {{.*}}DIFlagThunk
void C::f() {}
// Force C::f to be used.
diff --git a/test/CodeGenCXX/dllexport.cpp b/test/CodeGenCXX/dllexport.cpp
index a7b6aad357e5..5e4aa013b3c9 100644
--- a/test/CodeGenCXX/dllexport.cpp
+++ b/test/CodeGenCXX/dllexport.cpp
@@ -797,7 +797,7 @@ struct __declspec(dllexport) PR23308 {
};
void PR23308::f(InternalLinkageType*) {}
long use(PR23308* p) { p->f(nullptr); }
-// M32-DAG: define internal x86_thiscallcc void @"?f@PR23308@@QAEXPAUInternalLinkageType@?A@@@Z"
+// M32-DAG: define internal x86_thiscallcc void @"?f@PR23308@@QAEXPAUInternalLinkageType@?A0x{{[^@]*}}@@@Z"
template <typename T> struct PR23770BaseTemplate { void f() {} };
template <typename T> struct PR23770DerivedTemplate : PR23770BaseTemplate<int> {};
diff --git a/test/CodeGenCXX/mangle-ms.cpp b/test/CodeGenCXX/mangle-ms.cpp
index 3cc1b1645e9c..e128c9443153 100644
--- a/test/CodeGenCXX/mangle-ms.cpp
+++ b/test/CodeGenCXX/mangle-ms.cpp
@@ -15,7 +15,7 @@ namespace N {
namespace {
int anonymous;
-// CHECK-DAG: @"?anonymous@?A@N@@3HA"
+// CHECK-DAG: @"?anonymous@?A0x{{[^@]*}}@N@@3HA"
}
}
diff --git a/test/CodeGenCXX/microsoft-abi-structors.cpp b/test/CodeGenCXX/microsoft-abi-structors.cpp
index 97b90ce6b9eb..b0d2b5654030 100644
--- a/test/CodeGenCXX/microsoft-abi-structors.cpp
+++ b/test/CodeGenCXX/microsoft-abi-structors.cpp
@@ -467,9 +467,9 @@ struct A {
void *getA() {
return (void*)new A();
}
-// CHECK: define internal x86_thiscallcc i8* @"??_GA@?A@@UAEPAXI@Z"
+// CHECK: define internal x86_thiscallcc i8* @"??_GA@?A0x{{[^@]*}}@@UAEPAXI@Z"
// CHECK: (%"struct.(anonymous namespace)::A"* %this, i32 %should_call_delete)
-// CHECK: define internal x86_thiscallcc void @"??1A@?A@@UAE@XZ"
+// CHECK: define internal x86_thiscallcc void @"??1A@?A0x{{[^@]*}}@@UAE@XZ"
// CHECK: (%"struct.(anonymous namespace)::A"* %this)
// Check that we correctly transform __stdcall to __thiscall for ctors and
diff --git a/test/CodeGenCXX/microsoft-abi-throw.cpp b/test/CodeGenCXX/microsoft-abi-throw.cpp
index cbbce2daaad8..f55b94acf1d7 100644
--- a/test/CodeGenCXX/microsoft-abi-throw.cpp
+++ b/test/CodeGenCXX/microsoft-abi-throw.cpp
@@ -22,7 +22,7 @@
// CHECK-DAG: @_TI1P6AXXZ = linkonce_odr unnamed_addr constant %eh.ThrowInfo { i32 0, i8* null, i8* null, i8* bitcast (%eh.CatchableTypeArray.1* @_CTA1P6AXXZ to i8*) }, section ".xdata", comdat
// CHECK-DAG: @_TIU2PAPFAH = linkonce_odr unnamed_addr constant %eh.ThrowInfo { i32 4, i8* null, i8* null, i8* bitcast (%eh.CatchableTypeArray.2* @_CTA2PAPFAH to i8*) }, section ".xdata", comdat
// CHECK-DAG: @_CTA2PAPFAH = linkonce_odr unnamed_addr constant %eh.CatchableTypeArray.2 { i32 2, [2 x %eh.CatchableType*] [%eh.CatchableType* @"_CT??_R0PAPFAH@84", %eh.CatchableType* @"_CT??_R0PAX@84"] }, section ".xdata", comdat
-// CHECK-DAG: @"_TI1?AUFoo@?A@@" = internal unnamed_addr constant %eh.ThrowInfo { i32 0, i8* null, i8* null, i8* bitcast (%eh.CatchableTypeArray.1* @"_CTA1?AUFoo@?A@@" to i8*) }, section ".xdata"
+// CHECK-DAG: @"_TI1?AUFoo@?A0x{{[^@]*}}@@" = internal unnamed_addr constant %eh.ThrowInfo { i32 0, i8* null, i8* null, i8* bitcast (%eh.CatchableTypeArray.1* @"_CTA1?AUFoo@?A0x{{[^@]*}}@@" to i8*) }, section ".xdata"
struct N { ~N(); };
@@ -135,6 +135,6 @@ namespace { struct Foo { } foo_exc; }
void *GetExceptionInfo_test2() {
// CHECK-LABEL: @"?GetExceptionInfo_test2@@YAPAXXZ"
-// CHECK: ret i8* bitcast (%eh.ThrowInfo* @"_TI1?AUFoo@?A@@" to i8*)
+// CHECK: ret i8* bitcast (%eh.ThrowInfo* @"_TI1?AUFoo@?A0x{{[^@]*}}@@" to i8*)
return __GetExceptionInfo(foo_exc);
}
diff --git a/test/CodeGenCXX/microsoft-abi-thunks.cpp b/test/CodeGenCXX/microsoft-abi-thunks.cpp
index c2f64f38417c..2b0231ffe74e 100644
--- a/test/CodeGenCXX/microsoft-abi-thunks.cpp
+++ b/test/CodeGenCXX/microsoft-abi-thunks.cpp
@@ -160,5 +160,5 @@ struct E : D {
E::E() {}
E e;
// Class with internal linkage has internal linkage thunks.
-// CODEGEN: define internal x86_thiscallcc %struct.C* @"?goo@E@?A@@QAEPAUB@@XZ"
+// CODEGEN: define internal x86_thiscallcc %struct.C* @"?goo@E@?A0x{{[^@]*}}@@QAEPAUB@@XZ"
}
diff --git a/test/CodeGenCXX/microsoft-abi-vftables.cpp b/test/CodeGenCXX/microsoft-abi-vftables.cpp
index 65370ab1ece5..f8d26f14f91d 100644
--- a/test/CodeGenCXX/microsoft-abi-vftables.cpp
+++ b/test/CodeGenCXX/microsoft-abi-vftables.cpp
@@ -36,10 +36,10 @@ struct W {
virtual ~W() {}
} w;
}
-// RTTI-DAG: [[VTABLE_W:@.*]] = private unnamed_addr constant { [2 x i8*] } { [2 x i8*] [i8* bitcast ({{.*}} @"??_R4W@?A@@6B@" to i8*), i8* bitcast ({{.*}} @"??_GW@?A@@UAEPAXI@Z" to i8*)] }
-// RTTI-DAG: @"??_7W@?A@@6B@" = internal unnamed_addr alias i8*, getelementptr inbounds ({ [2 x i8*] }, { [2 x i8*] }* [[VTABLE_W]], i32 0, i32 0, i32 1)
+// RTTI-DAG: [[VTABLE_W:@.*]] = private unnamed_addr constant { [2 x i8*] } { [2 x i8*] [i8* bitcast ({{.*}} @"??_R4W@?A0x{{[^@]*}}@@6B@" to i8*), i8* bitcast ({{.*}} @"??_GW@?A0x{{[^@]*}}@@UAEPAXI@Z" to i8*)] }
+// RTTI-DAG: @"??_7W@?A0x{{[^@]*}}@@6B@" = internal unnamed_addr alias i8*, getelementptr inbounds ({ [2 x i8*] }, { [2 x i8*] }* [[VTABLE_W]], i32 0, i32 0, i32 1)
-// NO-RTTI-DAG: @"??_7W@?A@@6B@" = internal unnamed_addr constant { [1 x i8*] } { [1 x i8*] [i8* bitcast ({{.*}} @"??_GW@?A@@UAEPAXI@Z" to i8*)] }
+// NO-RTTI-DAG: @"??_7W@?A0x{{[^@]*}}@@6B@" = internal unnamed_addr constant { [1 x i8*] } { [1 x i8*] [i8* bitcast ({{.*}} @"??_GW@?A0x{{[^@]*}}@@UAEPAXI@Z" to i8*)] }
struct X {};
template <class> struct Y : virtual X {
diff --git a/test/CodeGenCXX/microsoft-abi-virtual-member-pointers.cpp b/test/CodeGenCXX/microsoft-abi-virtual-member-pointers.cpp
index ef8a5e486825..5ebe612e00ac 100644
--- a/test/CodeGenCXX/microsoft-abi-virtual-member-pointers.cpp
+++ b/test/CodeGenCXX/microsoft-abi-virtual-member-pointers.cpp
@@ -57,14 +57,14 @@ void f() {
// CHECK32: store i8* bitcast (void (%struct.C*, ...)* @"??_9C@@$BA@AE" to i8*), i8** %ptr
// CHECK32: store i8* bitcast (void (%struct.C*, ...)* @"??_9C@@$B3AE" to i8*), i8** %ptr2
// CHECK32: store i8* bitcast (void (%struct.C*, ...)* @"??_9C@@$B7AE" to i8*), i8** %ptr3
-// CHECK32: store i8* bitcast (void (%"struct.(anonymous namespace)::D"*, ...)* @"??_9D@?A@@$BA@AE" to i8*), i8** %ptr4
+// CHECK32: store i8* bitcast (void (%"struct.(anonymous namespace)::D"*, ...)* @"??_9D@?A0x{{[^@]*}}@@$BA@AE" to i8*), i8** %ptr4
// CHECK32: }
//
// CHECK64-LABEL: define dso_local void @"?f@@YAXXZ"()
// CHECK64: store i8* bitcast (void (%struct.C*, ...)* @"??_9C@@$BA@AA" to i8*), i8** %ptr
// CHECK64: store i8* bitcast (void (%struct.C*, ...)* @"??_9C@@$B7AA" to i8*), i8** %ptr2
// CHECK64: store i8* bitcast (void (%struct.C*, ...)* @"??_9C@@$BBA@AA" to i8*), i8** %ptr3
-// CHECK64: store i8* bitcast (void (%"struct.(anonymous namespace)::D"*, ...)* @"??_9D@?A@@$BA@AA" to i8*), i8** %ptr
+// CHECK64: store i8* bitcast (void (%"struct.(anonymous namespace)::D"*, ...)* @"??_9D@?A0x{{[^@]*}}@@$BA@AA" to i8*), i8** %ptr
// CHECK64: }
}
@@ -125,7 +125,7 @@ void f() {
// CHECK64: }
// Thunk for calling the virtual function in internal class D.
-// CHECK32-LABEL: define internal x86_thiscallcc void @"??_9D@?A@@$BA@AE"(%"struct.(anonymous namespace)::D"* %this, ...)
+// CHECK32-LABEL: define internal x86_thiscallcc void @"??_9D@?A0x{{[^@]*}}@@$BA@AE"(%"struct.(anonymous namespace)::D"* %this, ...)
// CHECK32: #[[ATTR]]
// CHECK32: [[VPTR:%.*]] = getelementptr inbounds void (%"struct.(anonymous namespace)::D"*, ...)*, void (%"struct.(anonymous namespace)::D"*, ...)** %{{.*}}, i64 0
// CHECK32: [[CALLEE:%.*]] = load void (%"struct.(anonymous namespace)::D"*, ...)*, void (%"struct.(anonymous namespace)::D"*, ...)** [[VPTR]]
@@ -133,7 +133,7 @@ void f() {
// CHECK32-NEXT: ret void
// CHECK32: }
//
-// CHECK64-LABEL: define internal void @"??_9D@?A@@$BA@AA"(%"struct.(anonymous namespace)::D"* %this, ...)
+// CHECK64-LABEL: define internal void @"??_9D@?A0x{{[^@]*}}@@$BA@AA"(%"struct.(anonymous namespace)::D"* %this, ...)
// CHECK64: #[[ATTR]]
// CHECK64: [[VPTR:%.*]] = getelementptr inbounds void (%"struct.(anonymous namespace)::D"*, ...)*, void (%"struct.(anonymous namespace)::D"*, ...)** %{{.*}}, i64 0
// CHECK64: [[CALLEE:%.*]] = load void (%"struct.(anonymous namespace)::D"*, ...)*, void (%"struct.(anonymous namespace)::D"*, ...)** [[VPTR]]
diff --git a/test/CodeGenCXX/msabi-swiftcall-cc.cpp b/test/CodeGenCXX/msabi-swiftcall-cc.cpp
index d8205ed192a5..3cc90a83fbd1 100644
--- a/test/CodeGenCXX/msabi-swiftcall-cc.cpp
+++ b/test/CodeGenCXX/msabi-swiftcall-cc.cpp
@@ -12,8 +12,8 @@ void (__attribute__((__swiftcall__)) *p)();
namespace {
void __attribute__((__swiftcall__)) __attribute__((__used__)) f() { }
}
-// CHECK-DAG: @"?f@?A@@YSXXZ"
-// CHECK-64-DAG: @"?f@?A@@YSXXZ"
+// CHECK-DAG: @"?f@?A0x{{[^@]*}}@@YSXXZ"
+// CHECK-64-DAG: @"?f@?A0x{{[^@]*}}@@YSXXZ"
namespace n {
void __attribute__((__swiftcall__)) f() {}
@@ -44,8 +44,8 @@ void (__attribute__((__preserve_most__)) *q)();
namespace {
void __attribute__((__preserve_most__)) __attribute__((__used__)) g() {}
}
-// CHECK-DAG: @"?g@?A@@YUXXZ"
-// CHECK-64-DAG: @"?g@?A@@YUXXZ"
+// CHECK-DAG: @"?g@?A0x{{[^@]*}}@@YUXXZ"
+// CHECK-64-DAG: @"?g@?A0x{{[^@]*}}@@YUXXZ"
namespace n {
void __attribute__((__preserve_most__)) g() {}
diff --git a/test/CodeGenCXX/pragma-init_seg.cpp b/test/CodeGenCXX/pragma-init_seg.cpp
index 8b33b854fd21..67a8bac3682a 100644
--- a/test/CodeGenCXX/pragma-init_seg.cpp
+++ b/test/CodeGenCXX/pragma-init_seg.cpp
@@ -28,8 +28,8 @@ int z = f();
namespace internal_init {
namespace {
int x = f();
-// CHECK: @"?x@?A@internal_init@@3HA" = internal global i32 0, align 4
-// CHECK: @__cxx_init_fn_ptr.2 = private constant void ()* @"??__Ex@?A@internal_init@@YAXXZ", section ".asdf"
+// CHECK: @"?x@?A0x{{[^@]*}}@internal_init@@3HA" = internal global i32 0, align 4
+// CHECK: @__cxx_init_fn_ptr.2 = private constant void ()* @"??__Ex@?A0x{{[^@]*}}@internal_init@@YAXXZ", section ".asdf"
}
}
diff --git a/test/CodeGenCXX/type-metadata.cpp b/test/CodeGenCXX/type-metadata.cpp
index 8e3e4bd182fe..a7a34673cdfc 100644
--- a/test/CodeGenCXX/type-metadata.cpp
+++ b/test/CodeGenCXX/type-metadata.cpp
@@ -82,8 +82,8 @@
// MS: comdat($"??_7B@@6B0@@"), !type [[B8:![0-9]+]]
// MS: comdat($"??_7B@@6BA@@@"), !type [[A8]]
// MS: comdat($"??_7C@@6B@"), !type [[A8]]
-// MS: comdat($"??_7D@?A@@6BB@@@"), !type [[B8]], !type [[D8:![0-9]+]]
-// MS: comdat($"??_7D@?A@@6BA@@@"), !type [[A8]]
+// MS: comdat($"??_7D@?A0x{{[^@]*}}@@6BB@@@"), !type [[B8]], !type [[D8:![0-9]+]]
+// MS: comdat($"??_7D@?A0x{{[^@]*}}@@6BA@@@"), !type [[A8]]
// MS: comdat($"??_7FA@?1??foo@@YAXXZ@6B@"), !type [[A8]], !type [[FA8:![0-9]+]]
struct A {
@@ -161,7 +161,7 @@ void af(A *a) {
}
// ITANIUM: define internal void @_Z3df1PN12_GLOBAL__N_11DE
-// MS: define internal void @"?df1@@YAXPEAUD@?A@@@Z"
+// MS: define internal void @"?df1@@YAXPEAUD@?A0x{{[^@]*}}@@@Z"
void df1(D *d) {
// TT-ITANIUM: {{%[^ ]*}} = call i1 @llvm.type.test(i8* {{%[^ ]*}}, metadata ![[DTYPE:[0-9]+]])
// TT-MS: {{%[^ ]*}} = call i1 @llvm.type.test(i8* {{%[^ ]*}}, metadata !"?AUA@@")
@@ -171,7 +171,7 @@ void df1(D *d) {
}
// ITANIUM: define internal void @_Z3dg1PN12_GLOBAL__N_11DE
-// MS: define internal void @"?dg1@@YAXPEAUD@?A@@@Z"
+// MS: define internal void @"?dg1@@YAXPEAUD@?A0x{{[^@]*}}@@@Z"
void dg1(D *d) {
// TT-ITANIUM: {{%[^ ]*}} = call i1 @llvm.type.test(i8* {{%[^ ]*}}, metadata !"_ZTS1B")
// TT-MS: {{%[^ ]*}} = call i1 @llvm.type.test(i8* {{%[^ ]*}}, metadata !"?AUB@@")
@@ -181,7 +181,7 @@ void dg1(D *d) {
}
// ITANIUM: define internal void @_Z3dh1PN12_GLOBAL__N_11DE
-// MS: define internal void @"?dh1@@YAXPEAUD@?A@@@Z"
+// MS: define internal void @"?dh1@@YAXPEAUD@?A0x{{[^@]*}}@@@Z"
void dh1(D *d) {
// TT-ITANIUM: {{%[^ ]*}} = call i1 @llvm.type.test(i8* {{%[^ ]*}}, metadata ![[DTYPE]])
// TT-MS: {{%[^ ]*}} = call i1 @llvm.type.test(i8* {{%[^ ]*}}, metadata ![[DTYPE:[0-9]+]])
@@ -191,7 +191,7 @@ void dh1(D *d) {
}
// ITANIUM: define internal void @_Z3df2PN12_GLOBAL__N_11DE
-// MS: define internal void @"?df2@@YAXPEAUD@?A@@@Z"
+// MS: define internal void @"?df2@@YAXPEAUD@?A0x{{[^@]*}}@@@Z"
__attribute__((no_sanitize("cfi")))
void df2(D *d) {
// CFI-NVT-NOT: call i1 @llvm.type.test
@@ -201,7 +201,7 @@ void df2(D *d) {
}
// ITANIUM: define internal void @_Z3df3PN12_GLOBAL__N_11DE
-// MS: define internal void @"?df3@@YAXPEAUD@?A@@@Z"
+// MS: define internal void @"?df3@@YAXPEAUD@?A0x{{[^@]*}}@@@Z"
__attribute__((no_sanitize("address"))) __attribute__((no_sanitize("cfi-vcall")))
void df3(D *d) {
// CFI-NVT-NOT: call i1 @llvm.type.test
diff --git a/test/Headers/ms-intrin.cpp b/test/Headers/ms-intrin.cpp
index d8a4d382eb37..b0fef9cc06a7 100644
--- a/test/Headers/ms-intrin.cpp
+++ b/test/Headers/ms-intrin.cpp
@@ -42,8 +42,6 @@ void f() {
__stosw(0, 0, 0);
#ifdef _M_X64
- __shiftleft128(1, 2, 3);
- __shiftright128(1, 2, 3);
__movsq(0, 0, 0);
__stosq(0, 0, 0);
#endif
diff --git a/test/OpenMP/declare_target_codegen.cpp b/test/OpenMP/declare_target_codegen.cpp
index 96bdc874ece2..abd108a6e784 100644
--- a/test/OpenMP/declare_target_codegen.cpp
+++ b/test/OpenMP/declare_target_codegen.cpp
@@ -91,5 +91,19 @@ int baz2() {
return 2 + baz3();
}
+extern int create() throw();
+
+static __typeof(create) __t_create __attribute__((__weakref__("__create")));
+
+int baz5() {
+ bool a;
+// CHECK-DAG: define weak void @__omp_offloading_{{.*}}baz5{{.*}}_l[[@LINE+1]](i64 {{.*}})
+#pragma omp target
+ a = __extension__(void *) & __t_create != 0;
+ return a;
+}
+
+// CHECK-DAG: declare extern_weak signext i32 @__create()
+
// CHECK-NOT: define {{.*}}{{baz1|baz4|maini1}}
#endif // HEADER
diff --git a/test/Sema/statements.c b/test/Sema/statements.c
index dbb4d56ee1d1..ddaec8d433ef 100644
--- a/test/Sema/statements.c
+++ b/test/Sema/statements.c
@@ -34,6 +34,15 @@ bar:
return &&bar; // expected-warning {{returning address of label, which is local}}
}
+// PR38569: Don't warn when returning a label from a statement expression.
+void test10_logpc(void*);
+void test10a() {
+ test10_logpc(({
+ my_pc:
+ &&my_pc;
+ }));
+}
+
// PR6034
void test11(int bit) {
switch (bit)