[PATCH] D37138: Make run-clang-tidy compatible with Python 3.x

2017-09-05 Thread Kevin Funk via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL312532: Make run-clang-tidy compatible with Python 3.x 
(authored by kfunk).

Changed prior to commit:
  https://reviews.llvm.org/D37138?vs=112677&id=113841#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D37138

Files:
  clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py


Index: clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py
===
--- clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py
+++ clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py
@@ -35,12 +35,12 @@
 """
 
 from __future__ import print_function
+
 import argparse
 import glob
 import json
 import multiprocessing
 import os
-import Queue
 import re
 import shutil
 import subprocess
@@ -50,6 +50,12 @@
 import traceback
 import yaml
 
+is_py2 = sys.version[0] == '2'
+
+if is_py2:
+import Queue as queue
+else:
+import queue as queue
 
 def find_compilation_database(path):
   """Adjusts the directory until a compilation database is found."""
@@ -233,20 +239,20 @@
 
   try:
 # Spin up a bunch of tidy-launching threads.
-queue = Queue.Queue(max_task)
+task_queue = queue.Queue(max_task)
 for _ in range(max_task):
   t = threading.Thread(target=run_tidy,
-   args=(args, tmpdir, build_path, queue))
+   args=(args, tmpdir, build_path, task_queue))
   t.daemon = True
   t.start()
 
 # Fill the queue with files.
 for name in files:
   if file_name_re.search(name):
-queue.put(name)
+task_queue.put(name)
 
 # Wait for all threads to be done.
-queue.join()
+task_queue.join()
 
   except KeyboardInterrupt:
 # This is a sad hack. Unfortunately subprocess goes


Index: clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py
===
--- clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py
+++ clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py
@@ -35,12 +35,12 @@
 """
 
 from __future__ import print_function
+
 import argparse
 import glob
 import json
 import multiprocessing
 import os
-import Queue
 import re
 import shutil
 import subprocess
@@ -50,6 +50,12 @@
 import traceback
 import yaml
 
+is_py2 = sys.version[0] == '2'
+
+if is_py2:
+import Queue as queue
+else:
+import queue as queue
 
 def find_compilation_database(path):
   """Adjusts the directory until a compilation database is found."""
@@ -233,20 +239,20 @@
 
   try:
 # Spin up a bunch of tidy-launching threads.
-queue = Queue.Queue(max_task)
+task_queue = queue.Queue(max_task)
 for _ in range(max_task):
   t = threading.Thread(target=run_tidy,
-   args=(args, tmpdir, build_path, queue))
+   args=(args, tmpdir, build_path, task_queue))
   t.daemon = True
   t.start()
 
 # Fill the queue with files.
 for name in files:
   if file_name_re.search(name):
-queue.put(name)
+task_queue.put(name)
 
 # Wait for all threads to be done.
-queue.join()
+task_queue.join()
 
   except KeyboardInterrupt:
 # This is a sad hack. Unfortunately subprocess goes
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D37479: run-clang-tidy: Report progress

2017-09-05 Thread Kevin Funk via Phabricator via cfe-commits
kfunk added a comment.

In https://reviews.llvm.org/D37479#861580, @Eugene.Zelenko wrote:

> I think will be good idea to introduce command line option to control 
> progress display: turn it off, show in absolute numbers or percents.


Honestly, I don't think this configurability is necessary. I'd like to keep 
that script here as simple as possible.

I'll wait for some more opinions.


https://reviews.llvm.org/D37479



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D37482: run-clang-tidy: Use check_call instead of check_output

2017-09-20 Thread Kevin Funk via Phabricator via cfe-commits
kfunk added a comment.

Bump? This is a trivial one


https://reviews.llvm.org/D37482



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D15729: Load compiler plugins in ASTUnit, too

2017-11-27 Thread Kevin Funk via Phabricator via cfe-commits
kfunk planned changes to this revision.
kfunk added a comment.

Marking this Diff properly -- it needs more work.


https://reviews.llvm.org/D15729



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D37482: run-clang-tidy: Use check_call instead of check_output

2017-11-27 Thread Kevin Funk via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL319148: run-clang-tidy: Use check_call instead of 
check_output (authored by kfunk).

Repository:
  rL LLVM

https://reviews.llvm.org/D37482

Files:
  clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py


Index: clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py
===
--- clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py
+++ clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py
@@ -222,7 +222,7 @@
 if args.checks:
   invocation.append('-checks=' + args.checks)
 invocation.append('-')
-print(subprocess.check_output(invocation))
+subprocess.check_call(invocation)
   except:
 print("Unable to run clang-tidy.", file=sys.stderr)
 sys.exit(1)


Index: clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py
===
--- clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py
+++ clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py
@@ -222,7 +222,7 @@
 if args.checks:
   invocation.append('-checks=' + args.checks)
 invocation.append('-')
-print(subprocess.check_output(invocation))
+subprocess.check_call(invocation)
   except:
 print("Unable to run clang-tidy.", file=sys.stderr)
 sys.exit(1)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D49890: Clang-Tidy Export Problem

2019-11-13 Thread Kevin Funk via Phabricator via cfe-commits
kfunk added a comment.

Is someone willing to pick up this patch again? It's still an issue.


Repository:
  rCTE Clang Tools Extra

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D49890/new/

https://reviews.llvm.org/D49890



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D18462: Fix for clang_Cursor_getSpellingNameRange()

2016-12-20 Thread Kevin Funk via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL290172: Fix for clang_Cursor_getSpellingNameRange() 
(authored by kfunk).

Changed prior to commit:
  https://reviews.llvm.org/D18462?vs=51608&id=82071#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D18462

Files:
  cfe/trunk/test/Index/get-cursor.cpp
  cfe/trunk/tools/libclang/CIndex.cpp


Index: cfe/trunk/tools/libclang/CIndex.cpp
===
--- cfe/trunk/tools/libclang/CIndex.cpp
+++ cfe/trunk/tools/libclang/CIndex.cpp
@@ -4429,7 +4429,8 @@
   }
 
   if (C.kind == CXCursor_CXXMethod || C.kind == CXCursor_Destructor ||
-  C.kind == CXCursor_ConversionFunction) {
+  C.kind == CXCursor_ConversionFunction ||
+  C.kind == CXCursor_FunctionDecl) {
 if (pieceIndex > 0)
   return clang_getNullRange();
 if (const FunctionDecl *FD =
Index: cfe/trunk/test/Index/get-cursor.cpp
===
--- cfe/trunk/test/Index/get-cursor.cpp
+++ cfe/trunk/test/Index/get-cursor.cpp
@@ -143,6 +143,8 @@
   }
 }
 
+const int operator""_toint(unsigned long long val) { return int(val); }
+
 // RUN: c-index-test -cursor-at=%s:6:4 %s | FileCheck 
-check-prefix=CHECK-COMPLETION-1 %s
 // CHECK-COMPLETION-1: CXXConstructor=X:6:3
 // CHECK-COMPLETION-1-NEXT: Completion string: {TypedText X}{LeftParen 
(}{Placeholder int}{Comma , }{Placeholder int}{RightParen )}
@@ -207,7 +209,7 @@
 // RUN: c-index-test -cursor-at=%s:66:23 %s | FileCheck 
-check-prefix=CHECK-TEMPLSPEC %s
 // CHECK-TEMPLSPEC: 66:23 ClassDecl=TC:66:23 (Definition) [Specialization of 
TC:59:7] Extent=[66:1 - 66:31] Spelling=TC ([66:23 - 66:25])
 
-// RUN: c-index-test -cursor-at=%s:69:3 -cursor-at=%s:70:11 -cursor-at=%s:73:6 
-cursor-at=%s:74:6 -cursor-at=%s:77:8 -cursor-at=%s:78:8 -cursor-at=%s:79:8 
-cursor-at=%s:80:8 -cursor-at=%s:81:8 -cursor-at=%s:82:8 -cursor-at=%s:85:6 
-cursor-at=%s:86:6 -cursor-at=%s:87:6 -cursor-at=%s:88:6 -cursor-at=%s:91:5 
-cursor-at=%s:92:5 -cursor-at=%s:93:5 -cursor-at=%s:94:5 -cursor-at=%s:95:5 
-cursor-at=%s:96:5 -cursor-at=%s:97:5 -cursor-at=%s:98:5 -cursor-at=%s:100:5 
-cursor-at=%s:101:5 -cursor-at=%s:104:6 -cursor-at=%s:105:6 -cursor-at=%s:106:6 
-cursor-at=%s:107:6 -cursor-at=%s:108:6 -cursor-at=%s:109:6 -cursor-at=%s:110:6 
-cursor-at=%s:111:6 -cursor-at=%s:113:6 -cursor-at=%s:114:6 -cursor-at=%s:117:8 
-cursor-at=%s:118:8 -cursor-at=%s:120:8 -cursor-at=%s:121:8 -cursor-at=%s:122:8 
-cursor-at=%s:123:8 -cursor-at=%s:124:8 -cursor-at=%s:125:8 -cursor-at=%s:128:6 
-cursor-at=%s:129:6 -cursor-at=%s:130:6 -cursor-at=%s:132:3 -std=c++11 %s | 
FileCheck -check-prefix=CHECK-SPELLING %s
+// RUN: c-index-test -cursor-at=%s:69:3 -cursor-at=%s:70:11 -cursor-at=%s:73:6 
-cursor-at=%s:74:6 -cursor-at=%s:77:8 -cursor-at=%s:78:8 -cursor-at=%s:79:8 
-cursor-at=%s:80:8 -cursor-at=%s:81:8 -cursor-at=%s:82:8 -cursor-at=%s:85:6 
-cursor-at=%s:86:6 -cursor-at=%s:87:6 -cursor-at=%s:88:6 -cursor-at=%s:91:5 
-cursor-at=%s:92:5 -cursor-at=%s:93:5 -cursor-at=%s:94:5 -cursor-at=%s:95:5 
-cursor-at=%s:96:5 -cursor-at=%s:97:5 -cursor-at=%s:98:5 -cursor-at=%s:100:5 
-cursor-at=%s:101:5 -cursor-at=%s:104:6 -cursor-at=%s:105:6 -cursor-at=%s:106:6 
-cursor-at=%s:107:6 -cursor-at=%s:108:6 -cursor-at=%s:109:6 -cursor-at=%s:110:6 
-cursor-at=%s:111:6 -cursor-at=%s:113:6 -cursor-at=%s:114:6 -cursor-at=%s:117:8 
-cursor-at=%s:118:8 -cursor-at=%s:120:8 -cursor-at=%s:121:8 -cursor-at=%s:122:8 
-cursor-at=%s:123:8 -cursor-at=%s:124:8 -cursor-at=%s:125:8 -cursor-at=%s:128:6 
-cursor-at=%s:129:6 -cursor-at=%s:130:6 -cursor-at=%s:132:3 
-cursor-at=%s:146:15 -std=c++11 %s | FileCheck -check-prefix=CHECK-SPELLING %s
 // CHECK-SPELLING: 69:3 CXXConstructor=A:69:3 (default constructor) 
Extent=[69:3 - 69:6] Spelling=A ([69:3 - 69:4])
 // CHECK-SPELLING: 70:11 CXXDestructor=~A:70:11 (virtual) Extent=[70:3 - 
70:15] Spelling=~A ([70:11 - 70:13])
 // CHECK-SPELLING: 73:6 CXXMethod=operator=:73:6 Extent=[73:3 - 73:25] 
Spelling=operator= ([73:6 - 73:15])
@@ -254,6 +256,7 @@
 // CHECK-SPELLING: 129:6 CXXMethod=operator->:129:6 Extent=[129:3 - 129:18] 
Spelling=operator-> ([129:6 - 129:16])
 // CHECK-SPELLING: 130:6 CXXMethod=operator():130:6 (const) Extent=[130:3 - 
130:37] Spelling=operator() ([130:6 - 130:16])
 // CHECK-SPELLING: 132:12 CXXConversion=operator bool:132:12 (const) 
Extent=[132:3 - 132:33] Spelling=operator bool ([132:12 - 132:25])
+// CHECK-SPELLING: 146:11 FunctionDecl=operator""_toint:146:11 (Definition) 
Extent=[146:1 - 146:72] Spelling=operator""_toint ([146:11 - 146:27])
 
 // RUN: c-index-test -cursor-at=%s:141:13 -cursor-at=%s:141:18 
-cursor-at=%s:142:11 -std=c++11 %s | FileCheck -check-prefix=CHECK-FORRANGE %s
 // CHECK-FORRANGE: 141:13 VarDecl=lv:141:13 (Definition) Extent=[141:8 - 
141:17] Spelling=lv ([141:13 - 141:15])


Index: cfe/trunk/tools/libclang/CIndex.cpp
===

[PATCH] D35194: [clang-tidy] clang-apply-replacements: Don't insert null entry

2017-07-10 Thread Kevin Funk via Phabricator via cfe-commits
kfunk updated this revision to Diff 105928.
kfunk added a comment.

Add test


https://reviews.llvm.org/D35194

Files:
  clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
  test/clang-apply-replacements/Inputs/invalid-files/invalid-files.yaml
  test/clang-apply-replacements/invalid-files.cpp


Index: test/clang-apply-replacements/invalid-files.cpp
===
--- /dev/null
+++ test/clang-apply-replacements/invalid-files.cpp
@@ -0,0 +1,8 @@
+// RUN: mkdir -p %T/Inputs/invalid-files
+// RUN: sed "s#\$(path)#%/T/Inputs/invalid-files#" 
%S/Inputs/invalid-files/invalid-files.yaml > 
%T/Inputs/invalid-files/invalid-files.yaml
+// RUN: clang-apply-replacements %T/Inputs/invalid-files
+//
+// Check that the yaml files are *not* deleted after running 
clang-apply-replacements without remove-change-desc-files.
+// RUN: ls -1 %T/Inputs/invalid-files | FileCheck %s --check-prefix=YAML
+//
+ YAML: {{.+\.yaml$}}
Index: test/clang-apply-replacements/Inputs/invalid-files/invalid-files.yaml
===
--- /dev/null
+++ test/clang-apply-replacements/Inputs/invalid-files/invalid-files.yaml
@@ -0,0 +1,12 @@
+---
+MainSourceFile:  ''
+Replacements:
+  - FilePath:idontexist.h
+Offset:  2669
+Length:  0
+ReplacementText: ' override'
+  - FilePath:idontexist.h
+Offset:  2669
+Length:  0
+ReplacementText: ' override'
+...
Index: clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
===
--- clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
+++ clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
@@ -289,9 +289,11 @@
   // Use the file manager to deduplicate paths. FileEntries are
   // automatically canonicalized.
   const FileEntry *Entry = SM.getFileManager().getFile(R.getFilePath());
-  if (!Entry && Warned.insert(R.getFilePath()).second) {
-errs() << "Described file '" << R.getFilePath()
-   << "' doesn't exist. Ignoring...\n";
+  if (!Entry) {
+if (Warned.insert(R.getFilePath()).second) {
+  errs() << "Described file '" << R.getFilePath()
+ << "' doesn't exist. Ignoring...\n";
+}
 continue;
   }
   GroupedReplacements[Entry].push_back(R);
@@ -315,9 +317,11 @@
   // Use the file manager to deduplicate paths. FileEntries are
   // automatically canonicalized.
   const FileEntry *Entry = 
SM.getFileManager().getFile(R.getFilePath());
-  if (!Entry && Warned.insert(R.getFilePath()).second) {
-errs() << "Described file '" << R.getFilePath()
-   << "' doesn't exist. Ignoring...\n";
+  if (!Entry) {
+if (Warned.insert(R.getFilePath()).second) {
+  errs() << "Described file '" << R.getFilePath()
+ << "' doesn't exist. Ignoring...\n";
+}
 continue;
   }
   GroupedReplacements[Entry].push_back(R);


Index: test/clang-apply-replacements/invalid-files.cpp
===
--- /dev/null
+++ test/clang-apply-replacements/invalid-files.cpp
@@ -0,0 +1,8 @@
+// RUN: mkdir -p %T/Inputs/invalid-files
+// RUN: sed "s#\$(path)#%/T/Inputs/invalid-files#" %S/Inputs/invalid-files/invalid-files.yaml > %T/Inputs/invalid-files/invalid-files.yaml
+// RUN: clang-apply-replacements %T/Inputs/invalid-files
+//
+// Check that the yaml files are *not* deleted after running clang-apply-replacements without remove-change-desc-files.
+// RUN: ls -1 %T/Inputs/invalid-files | FileCheck %s --check-prefix=YAML
+//
+ YAML: {{.+\.yaml$}}
Index: test/clang-apply-replacements/Inputs/invalid-files/invalid-files.yaml
===
--- /dev/null
+++ test/clang-apply-replacements/Inputs/invalid-files/invalid-files.yaml
@@ -0,0 +1,12 @@
+---
+MainSourceFile:  ''
+Replacements:
+  - FilePath:idontexist.h
+Offset:  2669
+Length:  0
+ReplacementText: ' override'
+  - FilePath:idontexist.h
+Offset:  2669
+Length:  0
+ReplacementText: ' override'
+...
Index: clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
===
--- clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
+++ clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
@@ -289,9 +289,11 @@
   // Use the file manager to deduplicate paths. FileEntries are
   // automatically canonicalized.
   const FileEntry *Entry = SM.getFileManager().getFile(R.getFilePath());
-  if (!Entry && Warned.insert(R.getFilePath()).second) {
-errs() << "Described file '" << R.getFilePath()
-   << "' doesn't exist. Ignoring...\n";
+   

[PATCH] D35194: [clang-tidy] clang-apply-replacements: Don't insert null entry

2017-07-10 Thread Kevin Funk via Phabricator via cfe-commits
kfunk updated this revision to Diff 105929.
kfunk added a comment.

Remove unnecessary `sed` line in test driver


https://reviews.llvm.org/D35194

Files:
  clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
  test/clang-apply-replacements/Inputs/invalid-files/invalid-files.yaml
  test/clang-apply-replacements/invalid-files.cpp


Index: test/clang-apply-replacements/invalid-files.cpp
===
--- /dev/null
+++ test/clang-apply-replacements/invalid-files.cpp
@@ -0,0 +1,7 @@
+// RUN: mkdir -p %T/Inputs/invalid-files
+// RUN: clang-apply-replacements %T/Inputs/invalid-files
+//
+// Check that the yaml files are *not* deleted after running 
clang-apply-replacements without remove-change-desc-files.
+// RUN: ls -1 %T/Inputs/invalid-files | FileCheck %s --check-prefix=YAML
+//
+ YAML: {{.+\.yaml$}}
Index: test/clang-apply-replacements/Inputs/invalid-files/invalid-files.yaml
===
--- /dev/null
+++ test/clang-apply-replacements/Inputs/invalid-files/invalid-files.yaml
@@ -0,0 +1,12 @@
+---
+MainSourceFile:  ''
+Replacements:
+  - FilePath:idontexist.h
+Offset:  2669
+Length:  0
+ReplacementText: ' override'
+  - FilePath:idontexist.h
+Offset:  2669
+Length:  0
+ReplacementText: ' override'
+...
Index: clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
===
--- clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
+++ clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
@@ -289,9 +289,11 @@
   // Use the file manager to deduplicate paths. FileEntries are
   // automatically canonicalized.
   const FileEntry *Entry = SM.getFileManager().getFile(R.getFilePath());
-  if (!Entry && Warned.insert(R.getFilePath()).second) {
-errs() << "Described file '" << R.getFilePath()
-   << "' doesn't exist. Ignoring...\n";
+  if (!Entry) {
+if (Warned.insert(R.getFilePath()).second) {
+  errs() << "Described file '" << R.getFilePath()
+ << "' doesn't exist. Ignoring...\n";
+}
 continue;
   }
   GroupedReplacements[Entry].push_back(R);
@@ -315,9 +317,11 @@
   // Use the file manager to deduplicate paths. FileEntries are
   // automatically canonicalized.
   const FileEntry *Entry = 
SM.getFileManager().getFile(R.getFilePath());
-  if (!Entry && Warned.insert(R.getFilePath()).second) {
-errs() << "Described file '" << R.getFilePath()
-   << "' doesn't exist. Ignoring...\n";
+  if (!Entry) {
+if (Warned.insert(R.getFilePath()).second) {
+  errs() << "Described file '" << R.getFilePath()
+ << "' doesn't exist. Ignoring...\n";
+}
 continue;
   }
   GroupedReplacements[Entry].push_back(R);


Index: test/clang-apply-replacements/invalid-files.cpp
===
--- /dev/null
+++ test/clang-apply-replacements/invalid-files.cpp
@@ -0,0 +1,7 @@
+// RUN: mkdir -p %T/Inputs/invalid-files
+// RUN: clang-apply-replacements %T/Inputs/invalid-files
+//
+// Check that the yaml files are *not* deleted after running clang-apply-replacements without remove-change-desc-files.
+// RUN: ls -1 %T/Inputs/invalid-files | FileCheck %s --check-prefix=YAML
+//
+ YAML: {{.+\.yaml$}}
Index: test/clang-apply-replacements/Inputs/invalid-files/invalid-files.yaml
===
--- /dev/null
+++ test/clang-apply-replacements/Inputs/invalid-files/invalid-files.yaml
@@ -0,0 +1,12 @@
+---
+MainSourceFile:  ''
+Replacements:
+  - FilePath:idontexist.h
+Offset:  2669
+Length:  0
+ReplacementText: ' override'
+  - FilePath:idontexist.h
+Offset:  2669
+Length:  0
+ReplacementText: ' override'
+...
Index: clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
===
--- clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
+++ clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
@@ -289,9 +289,11 @@
   // Use the file manager to deduplicate paths. FileEntries are
   // automatically canonicalized.
   const FileEntry *Entry = SM.getFileManager().getFile(R.getFilePath());
-  if (!Entry && Warned.insert(R.getFilePath()).second) {
-errs() << "Described file '" << R.getFilePath()
-   << "' doesn't exist. Ignoring...\n";
+  if (!Entry) {
+if (Warned.insert(R.getFilePath()).second) {
+  errs() << "Described file '" << R.getFilePath()
+ << "' doesn't exist. Ignoring...\n";
+}
 continue;
   }
   GroupedReplacem

[PATCH] D35194: [clang-tidy] clang-apply-replacements: Don't insert null entry

2017-07-11 Thread Kevin Funk via Phabricator via cfe-commits
kfunk added inline comments.



Comment at: clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp:296
+ << "' doesn't exist. Ignoring...\n";
+}
 continue;

yawanng wrote:
> Maybe add some error message here if it's not an existence issue. like 
> "invalid file path" or something? The same below.
Is that really necessary? I think the user won't care.


https://reviews.llvm.org/D35194



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D35194: [clang-tidy] clang-apply-replacements: Don't insert null entry

2017-07-25 Thread Kevin Funk via Phabricator via cfe-commits
kfunk updated this revision to Diff 108061.
kfunk added a comment.

Addressed concerns


https://reviews.llvm.org/D35194

Files:
  clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
  test/clang-apply-replacements/Inputs/invalid-files/invalid-files.yaml
  test/clang-apply-replacements/invalid-files.cpp


Index: test/clang-apply-replacements/invalid-files.cpp
===
--- /dev/null
+++ test/clang-apply-replacements/invalid-files.cpp
@@ -0,0 +1,5 @@
+// RUN: mkdir -p %T/invalid-files
+// RUN: clang-apply-replacements %T/invalid-files
+//
+// Check that the yaml files are *not* deleted after running 
clang-apply-replacements without remove-change-desc-files.
+// RUN: ls %T/Inputs/invalid-files/invalid-files.yaml
Index: test/clang-apply-replacements/Inputs/invalid-files/invalid-files.yaml
===
--- /dev/null
+++ test/clang-apply-replacements/Inputs/invalid-files/invalid-files.yaml
@@ -0,0 +1,12 @@
+---
+MainSourceFile:  ''
+Replacements:
+  - FilePath:idontexist.h
+Offset:  2669
+Length:  0
+ReplacementText: ' override'
+  - FilePath:idontexist.h
+Offset:  2669
+Length:  0
+ReplacementText: ' override'
+...
Index: clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
===
--- clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
+++ clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
@@ -288,13 +288,12 @@
 for (const tooling::Replacement &R : TU.Replacements) {
   // Use the file manager to deduplicate paths. FileEntries are
   // automatically canonicalized.
-  const FileEntry *Entry = SM.getFileManager().getFile(R.getFilePath());
-  if (!Entry && Warned.insert(R.getFilePath()).second) {
-errs() << "Described file '" << R.getFilePath()
-   << "' doesn't exist. Ignoring...\n";
-continue;
+  if (const FileEntry *Entry = 
SM.getFileManager().getFile(R.getFilePath())) {
+GroupedReplacements[Entry].push_back(R);
+  } else if (Warned.insert(R.getFilePath()).second) {
+  errs() << "Described file '" << R.getFilePath()
+ << "' doesn't exist. Ignoring...\n";
   }
-  GroupedReplacements[Entry].push_back(R);
 }
   }
 
@@ -314,13 +313,12 @@
 for (const tooling::Replacement &R : Fix.second) {
   // Use the file manager to deduplicate paths. FileEntries are
   // automatically canonicalized.
-  const FileEntry *Entry = 
SM.getFileManager().getFile(R.getFilePath());
-  if (!Entry && Warned.insert(R.getFilePath()).second) {
-errs() << "Described file '" << R.getFilePath()
-   << "' doesn't exist. Ignoring...\n";
-continue;
+  if (const FileEntry *Entry = 
SM.getFileManager().getFile(R.getFilePath())) {
+GroupedReplacements[Entry].push_back(R);
+  } else if (Warned.insert(R.getFilePath()).second) {
+  errs() << "Described file '" << R.getFilePath()
+ << "' doesn't exist. Ignoring...\n";
   }
-  GroupedReplacements[Entry].push_back(R);
 }
   }
 }


Index: test/clang-apply-replacements/invalid-files.cpp
===
--- /dev/null
+++ test/clang-apply-replacements/invalid-files.cpp
@@ -0,0 +1,5 @@
+// RUN: mkdir -p %T/invalid-files
+// RUN: clang-apply-replacements %T/invalid-files
+//
+// Check that the yaml files are *not* deleted after running clang-apply-replacements without remove-change-desc-files.
+// RUN: ls %T/Inputs/invalid-files/invalid-files.yaml
Index: test/clang-apply-replacements/Inputs/invalid-files/invalid-files.yaml
===
--- /dev/null
+++ test/clang-apply-replacements/Inputs/invalid-files/invalid-files.yaml
@@ -0,0 +1,12 @@
+---
+MainSourceFile:  ''
+Replacements:
+  - FilePath:idontexist.h
+Offset:  2669
+Length:  0
+ReplacementText: ' override'
+  - FilePath:idontexist.h
+Offset:  2669
+Length:  0
+ReplacementText: ' override'
+...
Index: clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
===
--- clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
+++ clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
@@ -288,13 +288,12 @@
 for (const tooling::Replacement &R : TU.Replacements) {
   // Use the file manager to deduplicate paths. FileEntries are
   // automatically canonicalized.
-  const FileEntry *Entry = SM.getFileManager().getFile(R.getFilePath());
-  if (!Entry && Warned.insert(R.getFilePath()).second) {
-errs() << "Described file '" << R.getFilePath()
-

[PATCH] D35194: [clang-tidy] clang-apply-replacements: Don't insert null entry

2017-07-25 Thread Kevin Funk via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL308974: [clang-tidy] clang-apply-replacements: Don't insert 
null entry (authored by kfunk).

Repository:
  rL LLVM

https://reviews.llvm.org/D35194

Files:
  
clang-tools-extra/trunk/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
  
clang-tools-extra/trunk/test/clang-apply-replacements/Inputs/invalid-files/invalid-files.yaml
  clang-tools-extra/trunk/test/clang-apply-replacements/invalid-files.cpp


Index: 
clang-tools-extra/trunk/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
===
--- 
clang-tools-extra/trunk/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
+++ 
clang-tools-extra/trunk/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
@@ -288,13 +288,12 @@
 for (const tooling::Replacement &R : TU.Replacements) {
   // Use the file manager to deduplicate paths. FileEntries are
   // automatically canonicalized.
-  const FileEntry *Entry = SM.getFileManager().getFile(R.getFilePath());
-  if (!Entry && Warned.insert(R.getFilePath()).second) {
-errs() << "Described file '" << R.getFilePath()
-   << "' doesn't exist. Ignoring...\n";
-continue;
+  if (const FileEntry *Entry = 
SM.getFileManager().getFile(R.getFilePath())) {
+GroupedReplacements[Entry].push_back(R);
+  } else if (Warned.insert(R.getFilePath()).second) {
+  errs() << "Described file '" << R.getFilePath()
+ << "' doesn't exist. Ignoring...\n";
   }
-  GroupedReplacements[Entry].push_back(R);
 }
   }
 
@@ -314,13 +313,12 @@
 for (const tooling::Replacement &R : Fix.second) {
   // Use the file manager to deduplicate paths. FileEntries are
   // automatically canonicalized.
-  const FileEntry *Entry = 
SM.getFileManager().getFile(R.getFilePath());
-  if (!Entry && Warned.insert(R.getFilePath()).second) {
-errs() << "Described file '" << R.getFilePath()
-   << "' doesn't exist. Ignoring...\n";
-continue;
+  if (const FileEntry *Entry = 
SM.getFileManager().getFile(R.getFilePath())) {
+GroupedReplacements[Entry].push_back(R);
+  } else if (Warned.insert(R.getFilePath()).second) {
+  errs() << "Described file '" << R.getFilePath()
+ << "' doesn't exist. Ignoring...\n";
   }
-  GroupedReplacements[Entry].push_back(R);
 }
   }
 }
Index: clang-tools-extra/trunk/test/clang-apply-replacements/invalid-files.cpp
===
--- clang-tools-extra/trunk/test/clang-apply-replacements/invalid-files.cpp
+++ clang-tools-extra/trunk/test/clang-apply-replacements/invalid-files.cpp
@@ -0,0 +1,5 @@
+// RUN: mkdir -p %T/invalid-files
+// RUN: clang-apply-replacements %T/invalid-files
+//
+// Check that the yaml files are *not* deleted after running 
clang-apply-replacements without remove-change-desc-files.
+// RUN: ls %T/Inputs/invalid-files/invalid-files.yaml
Index: 
clang-tools-extra/trunk/test/clang-apply-replacements/Inputs/invalid-files/invalid-files.yaml
===
--- 
clang-tools-extra/trunk/test/clang-apply-replacements/Inputs/invalid-files/invalid-files.yaml
+++ 
clang-tools-extra/trunk/test/clang-apply-replacements/Inputs/invalid-files/invalid-files.yaml
@@ -0,0 +1,12 @@
+---
+MainSourceFile:  ''
+Replacements:
+  - FilePath:idontexist.h
+Offset:  2669
+Length:  0
+ReplacementText: ' override'
+  - FilePath:idontexist.h
+Offset:  2669
+Length:  0
+ReplacementText: ' override'
+...


Index: clang-tools-extra/trunk/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
===
--- clang-tools-extra/trunk/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
+++ clang-tools-extra/trunk/clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
@@ -288,13 +288,12 @@
 for (const tooling::Replacement &R : TU.Replacements) {
   // Use the file manager to deduplicate paths. FileEntries are
   // automatically canonicalized.
-  const FileEntry *Entry = SM.getFileManager().getFile(R.getFilePath());
-  if (!Entry && Warned.insert(R.getFilePath()).second) {
-errs() << "Described file '" << R.getFilePath()
-   << "' doesn't exist. Ignoring...\n";
-continue;
+  if (const FileEntry *Entry = SM.getFileManager().getFile(R.getFilePath())) {
+GroupedReplacements[Entry].push_back(R);
+  } else if (Warned.insert(R.getFilePath()).second) {
+  errs() << "Described file '" << R.getFilePath()
+ << "' doesn't exist. Ignoring...\n";
   }
-  GroupedReplacements[Entry].push_back(R

[PATCH] D35194: [clang-tidy] clang-apply-replacements: Don't insert null entry

2017-07-25 Thread Kevin Funk via Phabricator via cfe-commits
kfunk added a comment.

Seems to have worked:

  Committing to https://llvm.org/svn/llvm-project/clang-tools-extra/trunk ...
  A   
test/clang-apply-replacements/Inputs/invalid-files/invalid-files.yaml
  A   test/clang-apply-replacements/invalid-files.cpp
  M   clang-apply-replacements/lib/Tooling/ApplyReplacements.cpp
  Committed r308974

I presume this Diff is being auto-closed by Phab?

Anyhow: Thanks for the review!


Repository:
  rL LLVM

https://reviews.llvm.org/D35194



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D27810: FileManager: mark virtual file entries as valid entries

2017-02-28 Thread Kevin Funk via Phabricator via cfe-commits
kfunk added a comment.

@erikjv Ready for review? Does this reliably fix 
https://bugreports.qt.io/browse/QTCREATORBUG-15449?


https://reviews.llvm.org/D27810



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D100028: [docs] Update clazy's URL in the external Clang examples page

2021-04-07 Thread Kevin Funk via Phabricator via cfe-commits
kfunk added a comment.

Looks good to me!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D100028/new/

https://reviews.llvm.org/D100028

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits