diff options
author | Andrzej Telszewski <atelszewski@gmail.com> | 2018-04-27 00:09:46 +0100 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2018-04-28 06:40:13 +0700 |
commit | c721b37c5690e1f2ab86f9cb820b0d10ea6b7374 (patch) | |
tree | c110ed08c4a92d4ee3c1ef3d39c0ee250d4887f2 /development/qt-creator-llvm/patches/090_D40746_Correctly-handle-line-table-entries-without-filenames-during-AST-serialization.patch | |
parent | a71de36093985c13cf3f841da68e23d042bde163 (diff) | |
download | slackbuilds-c721b37c5690e1f2ab86f9cb820b0d10ea6b7374.tar.gz slackbuilds-c721b37c5690e1f2ab86f9cb820b0d10ea6b7374.tar.xz |
development/qt-creator-llvm: Added (LLVM/Clang tools for QtCreator).
Signed-off-by: David Spencer <idlemoor@slackbuilds.org>
Diffstat (limited to 'development/qt-creator-llvm/patches/090_D40746_Correctly-handle-line-table-entries-without-filenames-during-AST-serialization.patch')
-rw-r--r-- | development/qt-creator-llvm/patches/090_D40746_Correctly-handle-line-table-entries-without-filenames-during-AST-serialization.patch | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/development/qt-creator-llvm/patches/090_D40746_Correctly-handle-line-table-entries-without-filenames-during-AST-serialization.patch b/development/qt-creator-llvm/patches/090_D40746_Correctly-handle-line-table-entries-without-filenames-during-AST-serialization.patch new file mode 100644 index 0000000000..c165c69fe5 --- /dev/null +++ b/development/qt-creator-llvm/patches/090_D40746_Correctly-handle-line-table-entries-without-filenames-during-AST-serialization.patch @@ -0,0 +1,47 @@ +--- a/tools/clang/lib/Serialization/ASTReader.cpp ++++ b/tools/clang/lib/Serialization/ASTReader.cpp +@@ -1220,6 +1220,7 @@ + + // Parse the file names + std::map<int, int> FileIDs; ++ FileIDs[-1] = -1; // For unspecified filenames. + for (unsigned I = 0; Record[Idx]; ++I) { + // Extract the file name + auto Filename = ReadPath(F, Record, Idx); +--- a/tools/clang/lib/Serialization/ASTWriter.cpp ++++ b/tools/clang/lib/Serialization/ASTWriter.cpp +@@ -2363,12 +2363,13 @@ + + // Emit the needed file names. + llvm::DenseMap<int, int> FilenameMap; ++ FilenameMap[-1] = -1; // For unspecified filenames. + for (const auto &L : LineTable) { + if (L.first.ID < 0) + continue; + for (auto &LE : L.second) { + if (FilenameMap.insert(std::make_pair(LE.FilenameID, +- FilenameMap.size())).second) ++ FilenameMap.size() - 1)).second) + AddPath(LineTable.getFilename(LE.FilenameID), Record); + } + } +--- a/tools/clang/test/PCH/line-directive-nofilename.h ++++ b/tools/clang/test/PCH/line-directive-nofilename.h +@@ -0,0 +1,5 @@ ++#line 42 ++int foo; // This should appear as at line-directive-nofilename.h:42 ++ ++#line 100 "foobar.h" ++int bar; // This should appear as at foobar.h:100 +--- a/tools/clang/test/PCH/line-directive-nofilename.c ++++ b/tools/clang/test/PCH/line-directive-nofilename.c +@@ -0,0 +1,9 @@ ++// RUN: %clang_cc1 -emit-pch -o %t %S/line-directive-nofilename.h ++// RUN: not %clang_cc1 -include-pch %t -fsyntax-only %s 2>&1 | FileCheck %s ++ ++// This causes an "error: redefinition" diagnostic. The notes will have the ++// locations of the declarations from the PCH file. ++double foo, bar; ++ ++// CHECK: line-directive-nofilename.h:42:5: note: previous definition is here ++// CHECK: foobar.h:100:5: note: previous definition is here |