LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 17035 - clang-format doesn't handle preprocessed source files
Summary: clang-format doesn't handle preprocessed source files
Status: RESOLVED FIXED
Alias: None
Product: clang
Classification: Unclassified
Component: Formatter (show other bugs)
Version: trunk
Hardware: PC Linux
: P normal
Assignee: Alexander Kornienko
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-29 06:41 PDT by labath
Modified: 2013-10-13 19:54 PDT (History)
3 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description labath 2013-08-29 06:41:59 PDT
$ cat /tmp/a.c 
#1 "a/file/with/incredibly/long/path/name/that/exceeds/80/characters/and/i/need/to/type/some/more"
int main() { return 0; }

$ clang /tmp/a.c

$ clang-format /tmp/a.c -style=LLVM -i

$ cat /tmp/a.c 
#1 "a/file/with/incredibly/long/path/name/that/exceeds/80/characters/and/i/"   \
   "need/to/type/some/more"
int main() { return 0; }

$ clang /tmp/a.c
/tmp/a.c:2:4: error: invalid flag line marker directive
   "need/to/type/some/more"
   ^
1 error generated.


Not a very common use case, I admit, but I have found it useful to be able to reformat preprocessed files. E.g., when I am hunting for compiler bugs, and I want to reduce the source manually, I would like to reprocess it first, because normal preprocessed output looks quite ugly.
Comment 1 Alexander Kornienko 2013-10-13 19:54:15 PDT
Fixed in r192507.