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 29135 - modernize-use-using assertion
Summary: modernize-use-using assertion
Status: RESOLVED FIXED
Alias: None
Product: clang-tools-extra
Classification: Unclassified
Component: clang-tidy (show other bugs)
Version: unspecified
Hardware: PC Windows NT
: P normal
Assignee: Alexander Kornienko
URL:
Keywords:
: 31452 31490 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-08-25 07:45 PDT by Aaron Ballman
Modified: 2017-01-17 10:14 PST (History)
7 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 Aaron Ballman 2016-08-25 07:45:00 PDT
Running the following command causes a failed assertion in Lexer::getSourceLocation because the location passed in to the function is not within the BufferStart and BufferEnd range.

clang-tidy -checks=-*,modernize-use-using E:\Desktop\test.cpp -- -std=c++14

I suspect this issue boils down to what includes are in use by the source manager, so my test case requires MSVC 2015. However, the test is quite simple:

#include <map>

typedef std::map<int, int> m;

I do not think this is a clang-tidy bug, but is likely instead a clang frontend bug with the lexer. However, since I can only reproduce this bug through clang-tidy, I am reporting it here.
Comment 1 Malcolm Parsons 2017-01-12 07:03:46 PST
*** Bug 31452 has been marked as a duplicate of this bug. ***
Comment 2 Malcolm Parsons 2017-01-12 07:04:16 PST
*** Bug 31490 has been marked as a duplicate of this bug. ***
Comment 3 Malcolm Parsons 2017-01-12 07:06:13 PST
bug 31490 has a stack trace.
Comment 4 Alexander Kornienko 2017-01-17 09:25:18 PST
Can someone provide an isolated (and, ideally, reduced) test case?
Comment 5 Alexander Kornienko 2017-01-17 09:30:10 PST
Actually, there's a test case in http://llvm.org/PR31452

$ cat test.cc
cat
struct Foo;
#define Bar Baz
typedef Foo Bar;

$ clang-tidy -checks=-*,modernize-use-using test.cc -- -std=c++11
tools/clang/lib/Lex/Lexer.cpp:1079: clang::SourceLocation clang::Lexer::getSourceLocation(const char *, unsigned int) const: Assertion `Loc >= BufferStart && Loc <= BufferEnd && "Location out of range for this buffer!"' failed.
Aborted (core dumped)
Comment 6 Alexander Kornienko 2017-01-17 09:31:54 PST
A stray cat sneaked into the test case. Here's the actual test:

struct Foo;
#define Bar Baz
typedef Foo Bar;
Comment 7 Alexander Kornienko 2017-01-17 10:14:48 PST
Should be fixed in r292229.