[llvm-branch-commits] [llvm] 01dd37b - test-release.sh: Kill python2

2021-07-29 Thread Diana Picus via llvm-branch-commits

Author: Diana Picus
Date: 2021-07-29T10:28:39+02:00
New Revision: 01dd37be9baea020b638d04c5523e153b1a102f9

URL: 
https://github.com/llvm/llvm-project/commit/01dd37be9baea020b638d04c5523e153b1a102f9
DIFF: 
https://github.com/llvm/llvm-project/commit/01dd37be9baea020b638d04c5523e153b1a102f9.diff

LOG: test-release.sh: Kill python2

Don't prefer python2's virtualenv when setting up the test-suite.
Always use python3 instead, since that's what we support everywhere else
anyway.

Differential Revision: https://reviews.llvm.org/D106941

Added: 


Modified: 
llvm/utils/release/test-release.sh

Removed: 




diff  --git a/llvm/utils/release/test-release.sh 
b/llvm/utils/release/test-release.sh
index 64ee411a69f65..5f602a451aedb 100755
--- a/llvm/utils/release/test-release.sh
+++ b/llvm/utils/release/test-release.sh
@@ -508,11 +508,8 @@ fi
 # Setup the test-suite.  Do this early so we can catch failures before
 # we do the full 3 stage build.
 if [ $do_test_suite = "yes" ]; then
-  venv=virtualenv
-  if ! type -P 'virtualenv' > /dev/null 2>&1 ; then
-check_program_exists 'python3'
-venv="python3 -m venv"
-  fi
+  check_program_exists 'python3'
+  venv="python3 -m venv"
 
   SandboxDir="$BuildDir/sandbox"
   Lit=$SandboxDir/bin/lit



___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] 0e3777b - [clang-format] Fix aligning with linebreaks #2

2021-07-29 Thread Tom Stellard via llvm-branch-commits

Author: Björn Schäpers
Date: 2021-07-29T06:59:53-07:00
New Revision: 0e3777bb0ad94ecd1429dc96409177cdccf39bdd

URL: 
https://github.com/llvm/llvm-project/commit/0e3777bb0ad94ecd1429dc96409177cdccf39bdd
DIFF: 
https://github.com/llvm/llvm-project/commit/0e3777bb0ad94ecd1429dc96409177cdccf39bdd.diff

LOG: [clang-format] Fix aligning with linebreaks #2

This amends c5243c63cda3c740d6e9c7e501f6518c21688da3 to fix formatting
continued function calls with BinPacking = false.

Differential Revision: https://reviews.llvm.org/D106773

(cherry picked from commit 75f6a795ee0faf544c3f539d01008d1d5d876acb)

Added: 


Modified: 
clang/lib/Format/WhitespaceManager.cpp
clang/unittests/Format/FormatTest.cpp

Removed: 




diff  --git a/clang/lib/Format/WhitespaceManager.cpp 
b/clang/lib/Format/WhitespaceManager.cpp
index cad1feffb..a822e0aaf1f93 100644
--- a/clang/lib/Format/WhitespaceManager.cpp
+++ b/clang/lib/Format/WhitespaceManager.cpp
@@ -347,7 +347,7 @@ AlignTokenSequence(const FormatStyle &Style, unsigned 
Start, unsigned End,
 if (ScopeStart > Start + 1 &&
 Changes[ScopeStart - 2].Tok->is(tok::identifier) &&
 Changes[ScopeStart - 1].Tok->is(tok::l_paren))
-  return true;
+  return Style.BinPackArguments;
 
 // Ternary operator
 if (Changes[i].Tok->is(TT_ConditionalExpr))

diff  --git a/clang/unittests/Format/FormatTest.cpp 
b/clang/unittests/Format/FormatTest.cpp
index 3adf42d34cf13..de00864143f7b 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -16411,6 +16411,37 @@ TEST_F(FormatTest, AlignWithLineBreaks) {
"}",
Style);
   // clang-format on
+
+  Style = getLLVMStyleWithColumns(120);
+  Style.AlignConsecutiveAssignments = FormatStyle::ACS_Consecutive;
+  Style.ContinuationIndentWidth = 4;
+  Style.IndentWidth = 4;
+
+  // clang-format off
+  verifyFormat("void SomeFunc() {\n"
+   "newWatcher.maxAgeUsec = 
ToLegacyTimestamp(GetMaxAge(FromLegacyTimestamp(monitorFrequencyUsec),\n"
+   "
seconds(std::uint64_t(maxSampleAge)), maxKeepSamples));\n"
+   "newWatcher.maxAge = 
ToLegacyTimestamp(GetMaxAge(FromLegacyTimestamp(monitorFrequencyUsec),\n"
+   "
seconds(std::uint64_t(maxSampleAge)), maxKeepSamples));\n"
+   "newWatcher.max= 
ToLegacyTimestamp(GetMaxAge(FromLegacyTimestamp(monitorFrequencyUsec),\n"
+   "
seconds(std::uint64_t(maxSampleAge)), maxKeepSamples));\n"
+   "}",
+   Style);
+  // clang-format on
+
+  Style.BinPackArguments = false;
+
+  // clang-format off
+  verifyFormat("void SomeFunc() {\n"
+   "newWatcher.maxAgeUsec = ToLegacyTimestamp(GetMaxAge(\n"
+   "
FromLegacyTimestamp(monitorFrequencyUsec), 
seconds(std::uint64_t(maxSampleAge)), maxKeepSamples));\n"
+   "newWatcher.maxAge = ToLegacyTimestamp(GetMaxAge(\n"
+   "
FromLegacyTimestamp(monitorFrequencyUsec), 
seconds(std::uint64_t(maxSampleAge)), maxKeepSamples));\n"
+   "newWatcher.max= ToLegacyTimestamp(GetMaxAge(\n"
+   "
FromLegacyTimestamp(monitorFrequencyUsec), 
seconds(std::uint64_t(maxSampleAge)), maxKeepSamples));\n"
+   "}",
+   Style);
+  // clang-format on
 }
 
 TEST_F(FormatTest, AlignWithInitializerPeriods) {



___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] ec4ebac - [AArch64][SVE] Fix incorrect mask type when lowering fixed type SVE gather/scatter

2021-07-29 Thread Tom Stellard via llvm-branch-commits

Author: Bradley Smith
Date: 2021-07-29T07:03:40-07:00
New Revision: ec4ebace85d0dd8001bef9a993d7223287a2cba4

URL: 
https://github.com/llvm/llvm-project/commit/ec4ebace85d0dd8001bef9a993d7223287a2cba4
DIFF: 
https://github.com/llvm/llvm-project/commit/ec4ebace85d0dd8001bef9a993d7223287a2cba4.diff

LOG: [AArch64][SVE] Fix incorrect mask type when lowering fixed type SVE 
gather/scatter

An incorrect mask type when lowering an SVE gather/scatter was causing
a codegen fault which manifested as the incorrect predicate size being
used for an SVE gather/scatter, (e.g.. p0.b rather than p0.d).

Fixes PR51182.

Differential Revision: https://reviews.llvm.org/D106943

(cherry picked from commit 191831e380f317cd2baa5d48abe02d1d11cd44cb)

Added: 


Modified: 
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
llvm/test/CodeGen/AArch64/sve-fixed-length-masked-gather.ll
llvm/test/CodeGen/AArch64/sve-fixed-length-masked-scatter.ll

Removed: 




diff  --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp 
b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
index e7282aad05e26..ae702eedcd666 100644
--- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -4348,6 +4348,9 @@ SDValue AArch64TargetLowering::LowerMGATHER(SDValue Op,
 IndexVT = getContainerForFixedLengthVector(DAG, IndexVT);
 MemVT = IndexVT.changeVectorElementType(MemVT.getVectorElementType());
 InputVT = DAG.getValueType(MemVT.changeTypeToInteger());
+Mask = DAG.getNode(
+ISD::ZERO_EXTEND, DL,
+VT.changeVectorElementType(IndexVT.getVectorElementType()), Mask);
   }
 
   if (PassThru->isUndef() || isZerosVector(PassThru.getNode()))
@@ -4452,6 +4455,9 @@ SDValue AArch64TargetLowering::LowerMSCATTER(SDValue Op,
 ISD::ANY_EXTEND, DL,
 VT.changeVectorElementType(IndexVT.getVectorElementType()), StoreVal);
 StoreVal = convertToScalableVector(DAG, IndexVT, StoreVal);
+Mask = DAG.getNode(
+ISD::ZERO_EXTEND, DL,
+VT.changeVectorElementType(IndexVT.getVectorElementType()), Mask);
   } else if (VT.isFloatingPoint()) {
 // Handle FP data by casting the data so an integer scatter can be used.
 EVT StoreValVT = getPackedSVEVectorVT(VT.getVectorElementCount());

diff  --git a/llvm/test/CodeGen/AArch64/sve-fixed-length-masked-gather.ll 
b/llvm/test/CodeGen/AArch64/sve-fixed-length-masked-gather.ll
index c8abd9fca7f64..20b8d10ebe30a 100644
--- a/llvm/test/CodeGen/AArch64/sve-fixed-length-masked-gather.ll
+++ b/llvm/test/CodeGen/AArch64/sve-fixed-length-masked-gather.ll
@@ -29,14 +29,16 @@ define void @masked_gather_v2i8(<2 x i8>* %a, <2 x i8*>* 
%b) #0 {
 ; CHECK: ldrb [[VALS_LO:w[0-9]+]], [x0]
 ; CHECK-NEXT: ldrb [[VALS_HI:w[0-9]+]], [x0, #1]
 ; CHECK-NEXT: ldr q[[PTRS:[0-9]+]], [x1]
-; CHECK-NEXT: ptrue [[PG0:p[0-9]+]].s, vl2
+; CHECK-NEXT: ptrue [[PG0:p[0-9]+]].d, vl2
 ; CHECK-NEXT: fmov s[[VALS:[0-9]+]], [[VALS_LO]]
 ; CHECK-NEXT: mov v[[VALS]].s[1], [[VALS_HI]]
 ; CHECK-NEXT: cmeq v[[CMP:[0-9]+]].2s, v[[VALS]].2s, #0
-; CHECK-NEXT: cmpne [[MASK:p[0-9]+]].s, [[PG0]]/z, z[[CMP]].s, #0
+; CHECK-NEXT: ushll v[[SHL:[0-9]+]].2d, v[[CMP]].2s, #0
+; CHECK-NEXT: cmpne [[MASK:p[0-9]+]].d, [[PG0]]/z, z[[SHL]].d, #0
 ; CHECK-NEXT: ld1sb { z[[RES:[0-9]+]].d }, [[MASK]]/z, [z[[PTRS]].d]
+; CHECK-NEXT: ptrue [[PG1:p[0-9]+]].s, vl2
 ; CHECK-NEXT: xtn v[[XTN:[0-9]+]].2s, v[[RES]].2d
-; CHECK-NEXT: st1b { z[[XTN]].s }, [[PG0]],  [x0]
+; CHECK-NEXT: st1b { z[[XTN]].s }, [[PG1]],  [x0]
 ; CHECK-NEXT: ret
   %cval = load <2 x i8>, <2 x i8>* %a
   %ptrs = load <2 x i8*>, <2 x i8*>* %b
@@ -51,11 +53,13 @@ define void @masked_gather_v4i8(<4 x i8>* %a, <4 x i8*>* 
%b) #0 {
 ; CHECK: ldr s[[VALS:[0-9]+]], [x0]
 ; CHECK-NEXT: ptrue [[PG0:p[0-9]+]].d, vl4
 ; CHECK-NEXT: ld1d { [[PTRS:z[0-9]+]].d }, [[PG0]]/z, [x1]
-; CHECK-NEXT: ptrue [[PG1:p[0-9]+]].h, vl4
 ; CHECK-NEXT: ushll [[SHL:v[0-9]+]].8h, v[[VALS]].8b, #0
 ; CHECK-NEXT: cmeq v[[CMP:[0-9]+]].4h, [[SHL]].4h, #0
-; CHECK-NEXT: cmpne [[MASK:p[0-9]+]].h, [[PG1]]/z, z[[CMP]].h, #0
+; CHECK-NEXT: uunpklo [[UPK1:z[0-9]+]].s, z[[CMP]].h
+; CHECK-NEXT: uunpklo [[UPK2:z[0-9]+]].d, [[UPK1]].s
+; CHECK-NEXT: cmpne [[MASK:p[0-9]+]].d, [[PG0]]/z, [[UPK2]].d, #0
 ; CHECK-NEXT: ld1sb { [[RES:z[0-9]+]].d }, [[MASK]]/z, {{\[}}[[PTRS]].d]
+; CHECK-NEXT: ptrue [[PG1:p[0-9]+]].h, vl4
 ; CHECK-NEXT: uzp1 [[UZP1:z[0-9]+]].s, [[RES]].s, [[RES]].s
 ; CHECK-NEXT: uzp1 z[[UZP2:[0-9]+]].h, [[UZP1]].h, [[UZP1]].h
 ; CHECK-NEXT: st1b { z[[UZP2]].h }, [[PG0]], [x0]
@@ -71,11 +75,13 @@ define void @masked_gather_v4i8(<4 x i8>* %a, <4 x i8*>* 
%b) #0 {
 define void @masked_gather_v8i8(<8 x i8>* %a, <8 x i8*>* %b) #0 {
 ; CHECK-LABEL: masked_gather_v8i8:
 ; VBITS_GE_512: ldr d[[VALS:[0-9]+]], [x0]
-; VBITS_GE_512-NEXT: ptrue [[PG0:p[0-9]+]].d, vl8
-; VBITS_GE_512-NEXT: ld1d { [[PTRS:z[0-9]+]].d }, [[PG0]]/z, [x1]
-; VBITS_GE_512-NEXT: ptrue [[PG

[llvm-branch-commits] [llvm] 6b2e4c5 - [DebugInfo][InstrRef] Don't break up ret-sequences on debug-info instrs

2021-07-29 Thread Jeremy Morse via llvm-branch-commits

Author: Jeremy Morse
Date: 2021-07-29T15:08:13+01:00
New Revision: 6b2e4c5a58d7f75f52b740bd7d96dc3a00b7ef6c

URL: 
https://github.com/llvm/llvm-project/commit/6b2e4c5a58d7f75f52b740bd7d96dc3a00b7ef6c
DIFF: 
https://github.com/llvm/llvm-project/commit/6b2e4c5a58d7f75f52b740bd7d96dc3a00b7ef6c.diff

LOG: [DebugInfo][InstrRef] Don't break up ret-sequences on debug-info instrs

When we have a terminator sequence (i.e. a tailcall or return),
MIIsInTerminatorSequence is used to work out where the preceding ABI-setup
instructions end, i.e. the parts that were glued to the terminator
instruction. This allows LLVM to split blocks safely without having to
worry about ABI stuff.

The function only ignores DBG_VALUE instructions, meaning that the two
debug instructions I recently added can end terminator sequences early,
causing various MachineVerifier errors. This patch promotes the test for
debug instructions from "isDebugValue" to "isDebugInstr", thus avoiding any
debug-info interfering with this function.

Differential Revision: https://reviews.llvm.org/D106660

(cherry picked from commit 8612417e5a54cfef941ab45de55e48b4a0c4e8b4)

Added: 
llvm/test/DebugInfo/ARM/instr-ref-tcreturn.ll

Modified: 
llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

Removed: 




diff  --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp 
b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index 1415cce3b1dff..09627ee6a1645 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -1660,7 +1660,7 @@ static bool MIIsInTerminatorSequence(const MachineInstr 
&MI) {
 // physical registers if there is debug info associated with the terminator
 // of our mbb. We want to include said debug info in our terminator
 // sequence, so we return true in that case.
-return MI.isDebugValue();
+return MI.isDebugInstr();
 
   // We have left the terminator sequence if we are not doing one of the
   // following:

diff  --git a/llvm/test/DebugInfo/ARM/instr-ref-tcreturn.ll 
b/llvm/test/DebugInfo/ARM/instr-ref-tcreturn.ll
new file mode 100644
index 0..f86e35061dc22
--- /dev/null
+++ b/llvm/test/DebugInfo/ARM/instr-ref-tcreturn.ll
@@ -0,0 +1,66 @@
+; RUN: llc %s -o - -stop-after=finalize-isel -verify-machineinstrs 
-experimental-debug-variable-locations | FileCheck %s
+
+; In the sequence below, the sdiv is converted to a function call to __divsi3,
+; which is then tail call optimised. The dbg.value is suddenly stuck between
+; terminators, and the corresponding DBG_INSTR_REF is forced-placed to be
+; immediately before the TCRETURN.
+; However, with the function having the sspstrong attribute, we then try to
+; peel apart the terminator sequence, DBG_INSTR_REF is interpreted as being
+; a "real" instruction, and the stack check is inserted at that point rather
+; than before the copies-to-physreg setting up the call. This breaks the
+; code, and MachineVerifier complains.
+;
+; Check that the tail sequence is stack-protected, and split at the correct
+; position, ignoring the DBG_INSTR_REF
+
+target datalayout = 
"e-m:o-p:32:32-Fi8-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32"
+target triple = "thumbv7-apple-ios7.0.0"
+
+; CHECK-LABEL:  bb.0.entry:
+; CHECK:LOAD_STACK_GUARD
+
+; CHECK-LABEL:  bb.2.entry:
+; CHECK:tBL {{.*}} &__stack_chk_fail,
+
+; CHECK-LABEL:  bb.1.entry:
+; CHECK:  $r0 = COPY %0
+; CHECK-NEXT: $r1 = COPY %1
+; CHECK-NEXT: DBG_INSTR_REF 1, 0
+; CHECK-NEXT: TCRETURNdi &__divsi3, 0, implicit $sp, implicit $r0, 
implicit $r1
+
+declare i1 @ext()
+
+define i32 @test(i32 %a1, i32 %a2) #1 !dbg !5 {
+entry:
+  %foo = alloca i32, i32 %a1
+  %bool = call i1 @ext()
+  %res = sdiv i32 %a1, %a2
+  call void @llvm.dbg.value(metadata i32 %a1, metadata !13, metadata 
!DIExpression()), !dbg !16
+  ret i32 %res
+}
+
+attributes #1 = {sspstrong}
+
+; Function Attrs: nounwind readnone speculatable willreturn
+declare void @llvm.dbg.value(metadata, metadata, metadata)
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!3, !4}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_Swift, file: !1, producer: 
"Swift", isOptimized: true, runtimeVersion: 5, emissionKind: FullDebug)
+!1 = !DIFile(filename: "foo.swift", directory: "/tmp")
+!2 = !{}
+!3 = !{i32 2, !"Debug Info Version", i32 3}
+!4 = !{i32 1, !"Swift Minor Version", i8 3}
+!5 = distinct !DISubprogram(name: "n0", linkageName: "n1", scope: !7, file: 
!6, line: 86, type: !8, scopeLine: 86, spFlags: DISPFlagDefinition | 
DISPFlagOptimized, unit: !0)
+!6 = !DIFile(filename: "bar.swift", directory: "")
+!7 = !DIModule(scope: null, name: "Swift")
+!8 = !DISubroutineType(types: !9)
+!9 = !{!10, !12}
+!10 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Int", 
scope: !7, file: !11, size: 32, elements: !2, runtimeLang: DW_LANG_Swift, 
identifier: "$i1")
+!11 = !DIFile(f

[llvm-branch-commits] [clang] 393e6e4 - Support macro deprecation #pragma clang deprecated

2021-07-29 Thread Chris Bieneman via llvm-branch-commits

Author: Chris Bieneman
Date: 2021-07-29T09:11:14-05:00
New Revision: 393e6e4cbc05f589c4dd75dbfae79ee44eb1a5f5

URL: 
https://github.com/llvm/llvm-project/commit/393e6e4cbc05f589c4dd75dbfae79ee44eb1a5f5
DIFF: 
https://github.com/llvm/llvm-project/commit/393e6e4cbc05f589c4dd75dbfae79ee44eb1a5f5.diff

LOG: Support macro deprecation #pragma clang deprecated

This patch adds `#pragma clang deprecated` to enable deprecation of
preprocessor macros.

The macro must be defined before `#pragma clang deprecated`. When
deprecating a macro a custom message may be optionally provided.

Warnings are emitted at the use site of a deprecated macro, and can be
controlled via the `-Wdeprecated` warning group.

This patch takes some rough inspiration and a few lines of code from
https://reviews.llvm.org/D67935.

Differential Revision: https://reviews.llvm.org/D106732

Added: 
clang/test/Lexer/deprecate-macro.c

Modified: 
clang/docs/LanguageExtensions.rst
clang/include/clang/Basic/DiagnosticGroups.td
clang/include/clang/Basic/DiagnosticLexKinds.td
clang/include/clang/Basic/IdentifierTable.h
clang/include/clang/Lex/Preprocessor.h
clang/lib/Lex/PPDirectives.cpp
clang/lib/Lex/PPExpressions.cpp
clang/lib/Lex/PPMacroExpansion.cpp
clang/lib/Lex/Pragma.cpp
clang/lib/Lex/Preprocessor.cpp

Removed: 




diff  --git a/clang/docs/LanguageExtensions.rst 
b/clang/docs/LanguageExtensions.rst
index 462aa89ea789a..8dafcb2f9a724 100644
--- a/clang/docs/LanguageExtensions.rst
+++ b/clang/docs/LanguageExtensions.rst
@@ -3887,6 +3887,24 @@ Since the size of ``buffer`` can't be known at compile 
time, Clang will fold
 as ``__builtin_dynamic_object_size(buffer, 0)``, Clang will fold it into
 ``size``, providing some extra runtime safety.
 
+Deprecating Macros
+==
+
+Clang supports the pragma ``#pragma clang deprecated``, which can be used to
+provide deprecation warnings for macro uses. For example:
+
+.. code-block:: c
+   #define MIN(x, y) x < y ? x : y
+   #pragma clang deprecated(MIN, "use std::min instead")
+
+   void min(int a, int b) {
+ return MIN(a, b); // warning: MIN is deprecated: use std::min instead
+   }
+
+``#pragma clang deprecated`` should be preferred for this purpose over
+``#pragma GCC warning`` because the warning can be controlled with
+``-Wdeprecated``.
+
 Extended Integer Types
 ==
 

diff  --git a/clang/include/clang/Basic/DiagnosticGroups.td 
b/clang/include/clang/Basic/DiagnosticGroups.td
index 4b4928a7a00e6..6857c889b72b6 100644
--- a/clang/include/clang/Basic/DiagnosticGroups.td
+++ b/clang/include/clang/Basic/DiagnosticGroups.td
@@ -184,6 +184,7 @@ def DeprecatedThisCapture : 
DiagGroup<"deprecated-this-capture">;
 def DeprecatedVolatile : DiagGroup<"deprecated-volatile">;
 def DeprecatedWritableStr : DiagGroup<"deprecated-writable-strings",
   [CXX11CompatDeprecatedWritableStr]>;
+def DeprecatedPragma : DiagGroup<"deprecated-pragma">;
 // FIXME: Why is DeprecatedImplementations not in this group?
 def Deprecated : DiagGroup<"deprecated", [DeprecatedAnonEnumEnumConversion,
   DeprecatedArrayCompare,
@@ -198,6 +199,7 @@ def Deprecated : DiagGroup<"deprecated", 
[DeprecatedAnonEnumEnumConversion,
   DeprecatedEnumEnumConversion,
   DeprecatedEnumFloatConversion,
   DeprecatedIncrementBool,
+  DeprecatedPragma,
   DeprecatedRegister,
   DeprecatedThisCapture,
   DeprecatedVolatile,

diff  --git a/clang/include/clang/Basic/DiagnosticLexKinds.td 
b/clang/include/clang/Basic/DiagnosticLexKinds.td
index ce6d0d0394b48..174f6c3dfd4c6 100644
--- a/clang/include/clang/Basic/DiagnosticLexKinds.td
+++ b/clang/include/clang/Basic/DiagnosticLexKinds.td
@@ -519,6 +519,11 @@ def warn_pragma_warning_expected_number :
   ExtWarn<"#pragma warning expected a warning number">,
   InGroup;
 
+// - #pragma deprecated(...)
+def warn_pragma_deprecated_macro_use :
+  ExtWarn<"macro %0 has been marked as deprecated%select{|: %2}1">,
+  InGroup;
+
 // - #pragma execution_character_set(...)
 def warn_pragma_exec_charset_expected :
   ExtWarn<"#pragma execution_character_set expected '%0'">,

diff  --git a/clang/include/clang/Basic/IdentifierTable.h 
b/clang/include/clang/Basic/IdentifierTable.h
index f2379c7ddfbd1..d75d43f0398d7 100644
--- a/clang/include/clang/Basic/IdentifierTable.h
+++ b/clang/include/clang/Basic/IdentifierTable.h
@@ -121,7 +121,10 @@ class alignas(IdentifierInfoAlignment) IdentifierInfo {
   // True if this is a mangled OpenMP variant name.
   unsigned IsMangledOpenMPVariantName : 1;
 
-  // 28 bits left in a 64

[llvm-branch-commits] [clang] 997d922 - This patch adds `#pragma clang header_unsafe` to enable flagging macros

2021-07-29 Thread Chris Bieneman via llvm-branch-commits

Author: Chris Bieneman
Date: 2021-07-29T10:10:51-05:00
New Revision: 997d9222f2ffa08c646076f2154993484e1ade98

URL: 
https://github.com/llvm/llvm-project/commit/997d9222f2ffa08c646076f2154993484e1ade98
DIFF: 
https://github.com/llvm/llvm-project/commit/997d9222f2ffa08c646076f2154993484e1ade98.diff

LOG: This patch adds `#pragma clang header_unsafe` to enable flagging macros
as unsafe for header use. This is to allow macros that may have ABI
implications to be avoided in headers that have ABI stability promises.

Using macros in headers (particularly public headers) can cause a
variety of issues relating to ABI and modules. This new pragma logs
warnings when using annotated macros outside the main source file.

This warning is added under a new diagnostics group -Wpedantic-macros.

Added: 
clang/test/Lexer/Inputs/unsafe-macro-2.h
clang/test/Lexer/Inputs/unsafe-macro.h
clang/test/Lexer/unsafe-macro.c

Modified: 
clang/docs/LanguageExtensions.rst
clang/include/clang/Basic/DiagnosticGroups.td
clang/include/clang/Basic/DiagnosticLexKinds.td
clang/include/clang/Basic/IdentifierTable.h
clang/include/clang/Lex/Preprocessor.h
clang/lib/Lex/Pragma.cpp
clang/lib/Lex/Preprocessor.cpp

Removed: 




diff  --git a/clang/docs/LanguageExtensions.rst 
b/clang/docs/LanguageExtensions.rst
index 8dafcb2f9a724..952db626535f4 100644
--- a/clang/docs/LanguageExtensions.rst
+++ b/clang/docs/LanguageExtensions.rst
@@ -3492,8 +3492,7 @@ The pragma can take two values: ``on`` and ``off``.
 float v = t + z;
   }
 
-
-``#pragma clang fp contract`` specifies whether the compiler should
+x2``#pragma clang fp contract`` specifies whether the compiler should
 contract a multiply and an addition (or subtraction) into a fused FMA
 operation when supported by the target.
 
@@ -3905,6 +3904,28 @@ provide deprecation warnings for macro uses. For example:
 ``#pragma GCC warning`` because the warning can be controlled with
 ``-Wdeprecated``.
 
+Header Unsafe Macros
+
+
+Clang supports the pragma ``#pragma clang header_unsafe``, which can be used to
+mark macros as unsafe to use in headers. This can be valuable when providing
+headers with ABI stability requirements. For example:
+
+.. code-block:: c
+   #define TARGET_ARM 1
+   #pragma clang header_unsafe(TARGET_ARM, "")
+
+   /// Foo.h
+   struct Foo {
+   #if TARGET_ARM // warning: TARGET_ARM is marked unsafe in headers: 
+ uint32_t X;
+   #else
+ uint64_t X;
+   #endif
+   };
+
+This warning is controlled by ``-Wpedantic-macros``.
+
 Extended Integer Types
 ==
 

diff  --git a/clang/include/clang/Basic/DiagnosticGroups.td 
b/clang/include/clang/Basic/DiagnosticGroups.td
index 6857c889b72b6..bd1cc3c7ff3cd 100644
--- a/clang/include/clang/Basic/DiagnosticGroups.td
+++ b/clang/include/clang/Basic/DiagnosticGroups.td
@@ -1305,3 +1305,7 @@ def WebAssemblyExceptionSpec : 
DiagGroup<"wasm-exception-spec">;
 def RTTI : DiagGroup<"rtti">;
 
 def OpenCLCoreFeaturesDiagGroup : DiagGroup<"pedantic-core-features">;
+
+// Warnings and extensions to make preprocessor macro usage pedantic
+def PedanticMacros : DiagGroup<"pedantic-macros",
+[DeprecatedPragma, MacroRedefined, BuiltinMacroRedefined]>;

diff  --git a/clang/include/clang/Basic/DiagnosticLexKinds.td 
b/clang/include/clang/Basic/DiagnosticLexKinds.td
index 174f6c3dfd4c6..ea4f0b2d5bb0c 100644
--- a/clang/include/clang/Basic/DiagnosticLexKinds.td
+++ b/clang/include/clang/Basic/DiagnosticLexKinds.td
@@ -524,6 +524,12 @@ def warn_pragma_deprecated_macro_use :
   ExtWarn<"macro %0 has been marked as deprecated%select{|: %2}1">,
   InGroup;
 
+// - #pragma clang header_unsafe(...)
+def warn_pragma_header_unsafe_macro_use :
+  ExtWarn<"macro %0 has been marked as unsafe for use in headers"
+  "%select{|: %2}1">,
+  InGroup;
+
 // - #pragma execution_character_set(...)
 def warn_pragma_exec_charset_expected :
   ExtWarn<"#pragma execution_character_set expected '%0'">,

diff  --git a/clang/include/clang/Basic/IdentifierTable.h 
b/clang/include/clang/Basic/IdentifierTable.h
index d75d43f0398d7..599d10f8bd00a 100644
--- a/clang/include/clang/Basic/IdentifierTable.h
+++ b/clang/include/clang/Basic/IdentifierTable.h
@@ -124,7 +124,10 @@ class alignas(IdentifierInfoAlignment) IdentifierInfo {
   // True if this is a deprecated macro
   unsigned IsDeprecatedMacro : 1;
 
-  // 24 bits left in a 64-bit word.
+  // True if this macro is unsafe in headers
+  unsigned IsHeaderUnsafe : 1;
+
+  // 23 bits left in a 64-bit word.
 
   // Managed by the language front-end.
   void *FETokenInfo = nullptr;
@@ -138,7 +141,7 @@ class alignas(IdentifierInfoAlignment) IdentifierInfo {
 NeedsHandleIdentifier(false), IsFromAST(false), 
ChangedAfterLoad(false),
 FEChangedAfterLoad(false), RevertedTokenID(false), OutOfDate(false),
 IsModulesImport(false), 

[llvm-branch-commits] [clang] 267dc10 - Implement #pragma clang final extension

2021-07-29 Thread Chris Bieneman via llvm-branch-commits

Author: Chris Bieneman
Date: 2021-07-29T11:19:25-05:00
New Revision: 267dc10d53f124dceeccee042f61e6e6624f6d4c

URL: 
https://github.com/llvm/llvm-project/commit/267dc10d53f124dceeccee042f61e6e6624f6d4c
DIFF: 
https://github.com/llvm/llvm-project/commit/267dc10d53f124dceeccee042f61e6e6624f6d4c.diff

LOG: Implement #pragma clang final extension

This patch adds a new preprocessor extension ``#pragma clang final``
which enables warning on undefinition and re-definition of macros.

The intent of this warning is to extend beyond ``-Wmacro-redefined`` to
warn against any and all alterations to macros that are marked `final`.

This warning is part of the ``-Wpedantic-macros`` diagnostics group.

Added: 
clang/test/Lexer/final-macro.c

Modified: 
clang/docs/LanguageExtensions.rst
clang/include/clang/Basic/DiagnosticGroups.td
clang/include/clang/Basic/DiagnosticLexKinds.td
clang/include/clang/Basic/IdentifierTable.h
clang/lib/Lex/PPDirectives.cpp
clang/lib/Lex/Pragma.cpp

Removed: 




diff  --git a/clang/docs/LanguageExtensions.rst 
b/clang/docs/LanguageExtensions.rst
index 952db626535f..54cb8164 100644
--- a/clang/docs/LanguageExtensions.rst
+++ b/clang/docs/LanguageExtensions.rst
@@ -3926,6 +3926,23 @@ headers with ABI stability requirements. For example:
 
 This warning is controlled by ``-Wpedantic-macros``.
 
+Final Macros
+
+
+Clang supports the pragma ``#pragma clang final``, which can be used to
+mark macros as final, meaning they cannot be undef'd or re-defined. For 
example:
+
+.. code-block:: c
+   #define FINAL_MACRO 1
+   #pragma clang final(FINAL_MACRO)
+
+   #undef FINAL_MACRO  // warning: FINAL_MACRO is marked final and should not 
be undefined
+   #define FINAL_MACRO // warning: FINAL_MACRO is marked final and should not 
be redefined
+
+This is useful for enforcing system-provided macros that should not be altered
+in user headers or code. This is controlled by ``-Wabi-stability`` and implies
+the related ``-Wmacro-redefined``.
+
 Extended Integer Types
 ==
 

diff  --git a/clang/include/clang/Basic/DiagnosticGroups.td 
b/clang/include/clang/Basic/DiagnosticGroups.td
index bd1cc3c7ff3c..341e120cf139 100644
--- a/clang/include/clang/Basic/DiagnosticGroups.td
+++ b/clang/include/clang/Basic/DiagnosticGroups.td
@@ -1308,4 +1308,4 @@ def OpenCLCoreFeaturesDiagGroup : 
DiagGroup<"pedantic-core-features">;
 
 // Warnings and extensions to make preprocessor macro usage pedantic
 def PedanticMacros : DiagGroup<"pedantic-macros",
-[DeprecatedPragma, MacroRedefined, BuiltinMacroRedefined]>;
+[DeprecatedPragma, MacroRedefined, BuiltinMacroRedefined]>;
\ No newline at end of file

diff  --git a/clang/include/clang/Basic/DiagnosticLexKinds.td 
b/clang/include/clang/Basic/DiagnosticLexKinds.td
index ea4f0b2d5bb0..e9db43e236e2 100644
--- a/clang/include/clang/Basic/DiagnosticLexKinds.td
+++ b/clang/include/clang/Basic/DiagnosticLexKinds.td
@@ -530,6 +530,12 @@ def warn_pragma_header_unsafe_macro_use :
   "%select{|: %2}1">,
   InGroup;
 
+// - #pragma clang final(...)
+def warn_pragma_final_macro :
+  ExtWarn<"macro %0 has been marked as final and should not be "
+  "%select{un|re}1defined">,
+  InGroup;
+
 // - #pragma execution_character_set(...)
 def warn_pragma_exec_charset_expected :
   ExtWarn<"#pragma execution_character_set expected '%0'">,

diff  --git a/clang/include/clang/Basic/IdentifierTable.h 
b/clang/include/clang/Basic/IdentifierTable.h
index 599d10f8bd00..67b824e79464 100644
--- a/clang/include/clang/Basic/IdentifierTable.h
+++ b/clang/include/clang/Basic/IdentifierTable.h
@@ -127,7 +127,10 @@ class alignas(IdentifierInfoAlignment) IdentifierInfo {
   // True if this macro is unsafe in headers
   unsigned IsHeaderUnsafe : 1;
 
-  // 23 bits left in a 64-bit word.
+  // True if this macro is final
+  unsigned IsFinal : 1;
+
+  // 22 bits left in a 64-bit word.
 
   // Managed by the language front-end.
   void *FETokenInfo = nullptr;
@@ -141,7 +144,7 @@ class alignas(IdentifierInfoAlignment) IdentifierInfo {
 NeedsHandleIdentifier(false), IsFromAST(false), 
ChangedAfterLoad(false),
 FEChangedAfterLoad(false), RevertedTokenID(false), OutOfDate(false),
 IsModulesImport(false), IsMangledOpenMPVariantName(false),
-IsDeprecatedMacro(false), IsHeaderUnsafe(false) {}
+IsDeprecatedMacro(false), IsHeaderUnsafe(false), IsFinal(false) {}
 
 public:
   IdentifierInfo(const IdentifierInfo &) = delete;
@@ -227,6 +230,12 @@ class alignas(IdentifierInfoAlignment) IdentifierInfo {
   RecomputeNeedsHandleIdentifier();
   }
 
+  bool isFinal() const { return IsFinal; }
+
+  void setIsFinal(bool Val) {
+IsFinal = Val;
+  }
+
   /// If this is a source-language token (e.g. 'for'), this API
   /// can be used to cause the lexer to map identifiers to source-language
   

[llvm-branch-commits] [lld] ad5a6b1 - [ELF] Add -Bsymbolic-non-weak-functions

2021-07-29 Thread Tom Stellard via llvm-branch-commits

Author: Fangrui Song
Date: 2021-07-29T19:29:45-07:00
New Revision: ad5a6b15ff04920a17524dd11adb828240c7103e

URL: 
https://github.com/llvm/llvm-project/commit/ad5a6b15ff04920a17524dd11adb828240c7103e
DIFF: 
https://github.com/llvm/llvm-project/commit/ad5a6b15ff04920a17524dd11adb828240c7103e.diff

LOG: [ELF] Add -Bsymbolic-non-weak-functions

This option is a subset of -Bsymbolic-functions. It applies to STB_GLOBAL
STT_FUNC definitions.

The address of a vague linkage function (STB_WEAK STT_FUNC, e.g. an inline
function, a template instantiation) seen by a -Bsymbolic-functions linked
shared object may be different from the address seen from outside the shared
object. Such cases are uncommon. (ELF/Mach-O programs may use
`-fvisibility-inlines-hidden` to break such pointer equality.  On Windows,
correct dllexport and dllimport are needed to make pointer equality work.
Windows link.exe enables /OPT:ICF by default so different inline functions may
have the same address.)

```
// a.cc -> a.o -> a.so (-Bsymbolic-functions)
inline void f() {}
void *g() { return (void *)&f; }

// b.cc -> b.o -> exe
// The address is different!
inline void f() {}
```

-Bsymbolic-non-weak-functions is a safer (C++ conforming) subset of
-Bsymbolic-functions, which can make such programs work.

Implementations usually emit a vague linkage definition in a COMDAT group.  We
could detect the group (with more code) but I feel that we should just check
STB_WEAK for simplicity. A weak definition will thus serve as an escape hatch
for rare cases when users want interposition on definitions.

GNU ld feature request: https://sourceware.org/bugzilla/show_bug.cgi?id=27871

Longer write-up: 
https://maskray.me/blog/2021-05-16-elf-interposition-and-bsymbolic

If Linux distributions migrate to protected non-vague-linkage external linkage
functions by default, the linker option can still be handy because it allows
rapid experiment without recompilation. Protected function addresses currently
have deep issues in GNU ld.

Reviewed By: peter.smith

Differential Revision: https://reviews.llvm.org/D102570

(cherry picked from commit b06426da764a8d0254521b33d667db8f26ae5e2f)

Added: 


Modified: 
lld/ELF/Config.h
lld/ELF/Driver.cpp
lld/ELF/Options.td
lld/ELF/Symbols.cpp
lld/ELF/SyntheticSections.cpp
lld/docs/ReleaseNotes.rst
lld/docs/ld.lld.1
lld/test/ELF/bsymbolic.s

Removed: 




diff  --git a/lld/ELF/Config.h b/lld/ELF/Config.h
index 9144347045b9..a996a815599a 100644
--- a/lld/ELF/Config.h
+++ b/lld/ELF/Config.h
@@ -38,6 +38,10 @@ enum ELFKind {
   ELF64BEKind
 };
 
+// For -Bno-symbolic, -Bsymbolic-non-weak-functions, -Bsymbolic-functions,
+// -Bsymbolic.
+enum class BsymbolicKind { None, NonWeakFunctions, Functions, All };
+
 // For --build-id.
 enum class BuildIdKind { None, Fast, Md5, Sha1, Hexstring, Uuid };
 
@@ -144,8 +148,7 @@ struct Configuration {
   bool armHasMovtMovw = false;
   bool armJ1J2BranchEncoding = false;
   bool asNeeded = false;
-  bool bsymbolic = false;
-  bool bsymbolicFunctions = false;
+  BsymbolicKind bsymbolic = BsymbolicKind::None;
   bool callGraphProfileSort;
   bool checkSections;
   bool checkDynamicRelocs;

diff  --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index a15959158653..91e7df21a60a 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -1006,12 +1006,15 @@ static void readConfigs(opt::InputArgList &args) {
OPT_no_allow_multiple_definition, false) ||
   hasZOption(args, "muldefs");
   config->auxiliaryList = args::getStrings(args, OPT_auxiliary);
-  if (opt::Arg *arg = args.getLastArg(OPT_Bno_symbolic, 
OPT_Bsymbolic_functions,
-  OPT_Bsymbolic)) {
-if (arg->getOption().matches(OPT_Bsymbolic_functions))
-  config->bsymbolicFunctions = true;
+  if (opt::Arg *arg =
+  args.getLastArg(OPT_Bno_symbolic, OPT_Bsymbolic_non_weak_functions,
+  OPT_Bsymbolic_functions, OPT_Bsymbolic)) {
+if (arg->getOption().matches(OPT_Bsymbolic_non_weak_functions))
+  config->bsymbolic = BsymbolicKind::NonWeakFunctions;
+else if (arg->getOption().matches(OPT_Bsymbolic_functions))
+  config->bsymbolic = BsymbolicKind::Functions;
 else if (arg->getOption().matches(OPT_Bsymbolic))
-  config->bsymbolic = true;
+  config->bsymbolic = BsymbolicKind::All;
   }
   config->checkSections =
   args.hasFlag(OPT_check_sections, OPT_no_check_sections, true);
@@ -1374,7 +1377,8 @@ static void readConfigs(opt::InputArgList &args) {
   // When producing an executable, --dynamic-list specifies non-local defined
   // symbols which are required to be exported. When producing a shared object,
   // symbols not specified by --dynamic-list are non-preemptible.
-  config->symbolic = config->bsymbolic || args.hasArg(OPT_dynamic_list);
+  config->symbolic =
+  config->bsymbolic == BsymbolicKind::Al

[llvm-branch-commits] [clang] 6eaf46b - Revert "Revert "[clang][pp] adds '#pragma include_instead'""

2021-07-29 Thread Tom Stellard via llvm-branch-commits

Author: Christopher Di Bella
Date: 2021-07-29T19:32:26-07:00
New Revision: 6eaf46beb4628abf8f5b09a333bcd44d2fb2aff9

URL: 
https://github.com/llvm/llvm-project/commit/6eaf46beb4628abf8f5b09a333bcd44d2fb2aff9
DIFF: 
https://github.com/llvm/llvm-project/commit/6eaf46beb4628abf8f5b09a333bcd44d2fb2aff9.diff

LOG: Revert "Revert "[clang][pp] adds '#pragma include_instead'""

Includes regression test for problem noted by @hans.
This reverts commit 973de7185606a21fd5e9d5e8c014fbf898c0e72f.

Differential Revision: https://reviews.llvm.org/D106898

(cherry picked from commit 087195419719e908394081b4cc6f365170b9882c)

Added: 
clang/test/PCH/ms-pch-macro-include_instead-regression.c
clang/test/Preprocessor/Inputs/include_instead/bad-syntax.h
clang/test/Preprocessor/Inputs/include_instead/file-not-found.h
clang/test/Preprocessor/Inputs/include_instead/non-system-header.h
clang/test/Preprocessor/Inputs/include_instead/private-x.h
clang/test/Preprocessor/Inputs/include_instead/private1.h
clang/test/Preprocessor/Inputs/include_instead/private2.h
clang/test/Preprocessor/Inputs/include_instead/private3.h
clang/test/Preprocessor/Inputs/include_instead/public-after.h
clang/test/Preprocessor/Inputs/include_instead/public-before.h
clang/test/Preprocessor/Inputs/include_instead/public-empty.h
clang/test/Preprocessor/include_instead.cpp
clang/test/Preprocessor/include_instead_file_not_found.cpp

Modified: 
clang/include/clang/Basic/DiagnosticLexKinds.td
clang/include/clang/Lex/HeaderSearch.h
clang/include/clang/Lex/Preprocessor.h
clang/include/clang/Lex/PreprocessorLexer.h
clang/lib/Lex/Lexer.cpp
clang/lib/Lex/PPDirectives.cpp
clang/lib/Lex/PPLexerChange.cpp
clang/lib/Lex/Pragma.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/DiagnosticLexKinds.td 
b/clang/include/clang/Basic/DiagnosticLexKinds.td
index ce6d0d0394b4..bdf5d263fa92 100644
--- a/clang/include/clang/Basic/DiagnosticLexKinds.td
+++ b/clang/include/clang/Basic/DiagnosticLexKinds.td
@@ -300,6 +300,13 @@ def pp_pragma_once_in_main_file : Warning<"#pragma once in 
main file">,
 def pp_pragma_sysheader_in_main_file : Warning<
   "#pragma system_header ignored in main file">,
   InGroup>;
+
+def err_pragma_include_instead_not_sysheader : Error<
+  "'#pragma clang include_instead' cannot be used outside of system headers">;
+def err_pragma_include_instead_system_reserved : Error<
+  "header '%0' is an implementation detail; #include %select{'%2'|either '%2' "
+  "or '%3'|one of %2}1 instead">;
+
 def pp_poisoning_existing_macro : Warning<"poisoning existing macro">;
 def pp_out_of_date_dependency : Warning<
   "current file is older than dependency %0">;

diff  --git a/clang/include/clang/Lex/HeaderSearch.h 
b/clang/include/clang/Lex/HeaderSearch.h
index 93d6ea72270a..a35a394f719b 100644
--- a/clang/include/clang/Lex/HeaderSearch.h
+++ b/clang/include/clang/Lex/HeaderSearch.h
@@ -20,9 +20,12 @@
 #include "clang/Lex/ModuleMap.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/SetVector.h"
+#include "llvm/ADT/SmallSet.h"
+#include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/StringMap.h"
-#include "llvm/ADT/StringSet.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/StringSet.h"
 #include "llvm/Support/Allocator.h"
 #include 
 #include 
@@ -110,6 +113,14 @@ struct HeaderFileInfo {
   /// of the framework.
   StringRef Framework;
 
+  /// List of aliases that this header is known as.
+  /// Most headers should only have at most one alias, but a handful
+  /// have two.
+  llvm::SetVector,
+  llvm::SmallVector, 2>,
+  llvm::SmallSet, 2>>
+  Aliases;
+
   HeaderFileInfo()
   : isImport(false), isPragmaOnce(false), DirInfo(SrcMgr::C_User),
 External(false), isModuleHeader(false), isCompilingModuleHeader(false),
@@ -453,6 +464,10 @@ class HeaderSearch {
 getFileInfo(File).DirInfo = SrcMgr::C_System;
   }
 
+  void AddFileAlias(const FileEntry *File, StringRef Alias) {
+getFileInfo(File).Aliases.insert(Alias);
+  }
+
   /// Mark the specified file as part of a module.
   void MarkFileModuleHeader(const FileEntry *FE,
 ModuleMap::ModuleHeaderRole Role,

diff  --git a/clang/include/clang/Lex/Preprocessor.h 
b/clang/include/clang/Lex/Preprocessor.h
index 7ab13640ce2c..fe2327f0a480 100644
--- a/clang/include/clang/Lex/Preprocessor.h
+++ b/clang/include/clang/Lex/Preprocessor.h
@@ -1953,7 +1953,8 @@ class Preprocessor {
   /// This either returns the EOF token and returns true, or
   /// pops a level off the include stack and returns false, at which point the
   /// client should call lex again.
-  bool HandleEndOfFile(Token &Result, bool isEndOfMacro = false);
+  bool HandleEndOfFile(Token &Result, SourceLocation Loc,
+   bool isEndOfMacro = false);
 
   /// Callbac